from beyond.dates import Date, timedelta
from beyond.utils import ltan
from beyond.env import solarsystem


eps = 1e-14


def test_ltan2raan(common_env):

    date = Date(2020, 1, 29, 18, 27)

    assert abs(ltan.ltan2raan(date, 22.5 * 3600) - 1.8496591694176407) < eps
    assert abs(ltan.ltan2raan(date, 22.5 * 3600, "true") - 1.901700132311372) < eps


def test_raan2ltan(common_env, iss_tle):

    orb = iss_tle.orbit().copy(frame="EME2000", form="keplerian")

    assert abs(ltan.raan2ltan(orb.date, orb.raan) / 3600 - 0.903570175768742) < eps
    assert abs(ltan.raan2ltan(orb.date, orb.raan, "true") / 3600 - 0.9741125897719947) < eps

@@ -1,20 +1,45 @@
+from pytest import mark%0A%0A
 from beyond.dates im
@@ -140,16 +140,150 @@
 1e-14%0A%0A%0A
+@mark.parametrize(%0A    %22type, expected%22,%0A    %5B(%22mean%22, 1.8496591694176407), (%22true%22, 1.901700132311372)%5D,%0A    ids=(%22mean%22, %22true%22),%0A)%0A
 def test
@@ -303,16 +303,32 @@
 mmon_env
+, type, expected
 ):%0A%0A    
@@ -360,17 +360,16 @@
 18, 27)%0A
-%0A
     asse
@@ -411,123 +411,169 @@
 3600
-) - 1.8496591694176407) %3C eps%0A    assert abs(ltan.ltan2raan(date, 22.5 * 3600
+, type) - expected) %3C eps%0A%0A%0A@mark.parametrize(%0A    %22type, expected%22,%0A    %5B(%22mean%22, 0.903570175768742)
 , 
+(
 %22true%22
-) - 1.901700132311372) %3C eps%0A%0A
+, 0.9741125897719947)%5D,%0A    ids=(%22mean%22, %22true%22),%0A)
 %0Adef
@@ -607,16 +607,32 @@
  iss_tle
+, type, expected
 ):%0A%0A    
@@ -693,17 +693,16 @@
 erian%22)%0A
-%0A
     asse
@@ -741,16 +741,22 @@
 orb.raan
+, type
 ) / 3600
@@ -762,118 +762,16 @@
 0 - 
-0.903570175768742) %3C eps%0A    assert abs(ltan.raan2ltan(orb.date, orb.raan, %22true%22) / 3600 - 0.9741125897719947
+expected
 ) %3C 

test ltan : parametrize for more granularity