Skip to content

Commit d0ec74d

Browse files
committed
Introduce non-hypothesis example for use in astropy#9579
1 parent aa73ef3 commit d0ec74d

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

‎astropy/time/tests/test_precision.py‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ def test_timedelta_conversion(scale1, scale2, jds_a, jds_b):
526526
_utc_bad = [(pytest.param(s, marks=pytest.mark.xfail) if s == 'utc' else s)
527527
for s in _scales]
528528
# datetimes have microsecond resolution
529-
# @pytest.mark.xfail
529+
@pytest.mark.xfail
530530
@given(datetimes(), datetimes())
531531
@example(dt1=datetime(1235, 1, 1, 0, 0),
532532
dt2=datetime(9950, 1, 1, 0, 0, 0, 890773))
@@ -540,8 +540,18 @@ def test_datetime_difference_agrees_with_timedelta(scale, dt1, dt2):
540540
atol=25*u.us)
541541

542542

543+
@pytest.mark.xfail
544+
def test_datetime_difference_agrees_with_timedelta_no_hypothesis():
545+
scale = "tai"
546+
dt1 = datetime(1235, 1, 1, 0, 0)
547+
dt2 = datetime(9950, 1, 1, 0, 0, 0, 890773)
548+
t1 = Time(dt1, scale=scale)
549+
t2 = Time(dt2, scale=scale)
550+
assert(abs((t2-t1) - TimeDelta(dt2-dt1, scale=scale)) < 25*u.us)
551+
552+
543553
# datetimes have microsecond resolution
544-
# @pytest.mark.xfail
554+
@pytest.mark.xfail
545555
@given(datetimes(), timedeltas())
546556
@example(dt=datetime(2000, 1, 1, 0, 0),
547557
td=timedelta(days=-397683, microseconds=2))
@@ -570,7 +580,7 @@ def test_datetime_timedelta_sum(scale, dt, td):
570580
# go in test_sidereal.py instead.
571581

572582
sidereal_day_frac = ((1*u.year-1*u.day)/(1*u.year)).to_value(1)
573-
# @pytest.mark.xfail
583+
@pytest.mark.xfail
574584
@given(reasonable_jd(), floats(-180, 180))
575585
@example(kind='mean', jds=(2455000.0, 0.0), lon=-85.87226916203973)
576586
@pytest.mark.parametrize("kind", ["apparent", "mean"])

0 commit comments

Comments
 (0)