def test_iso_of_decimal_that_rounds_down():
    jd = JulianDate(utc=(2014, 12, 21, 6, 3, 1.234234))
    assert jd.utc_iso(places=0) == "2014-12-21T06:03:01Z"
    assert jd.utc_iso(places=1) == "2014-12-21T06:03:01.2Z"
    assert jd.utc_iso(places=2) == "2014-12-21T06:03:01.23Z"
    assert jd.utc_iso(places=3) == "2014-12-21T06:03:01.234Z"
    assert jd.utc_iso(places=4) == "2014-12-21T06:03:01.2342Z"
def test_iso_of_leap_second_with_fraction():
    jd = JulianDate(utc=(1973, 12, 31, 23, 59, 60.12349))
    assert jd.utc_iso(places=0) == "1973-12-31T23:59:60Z"
    assert jd.utc_iso(places=1) == "1973-12-31T23:59:60.1Z"
    assert jd.utc_iso(places=2) == "1973-12-31T23:59:60.12Z"
    assert jd.utc_iso(places=3) == "1973-12-31T23:59:60.123Z"
    assert jd.utc_iso(places=4) == "1973-12-31T23:59:60.1235Z"
def test_iso_of_leap_second_with_fraction():
    jd = JulianDate(utc=(1973, 12, 31, 23, 59, 60.12349))
    assert jd.utc_iso(places=0) == '1973-12-31T23:59:60Z'
    assert jd.utc_iso(places=1) == '1973-12-31T23:59:60.1Z'
    assert jd.utc_iso(places=2) == '1973-12-31T23:59:60.12Z'
    assert jd.utc_iso(places=3) == '1973-12-31T23:59:60.123Z'
    assert jd.utc_iso(places=4) == '1973-12-31T23:59:60.1235Z'
def test_iso_of_decimal_that_rounds_up():
    jd = JulianDate(utc=(1915, 12, 2, 3, 4, 5.6786786))
    assert jd.utc_iso(places=0) == "1915-12-02T03:04:06Z"
    assert jd.utc_iso(places=1) == "1915-12-02T03:04:05.7Z"
    assert jd.utc_iso(places=2) == "1915-12-02T03:04:05.68Z"
    assert jd.utc_iso(places=3) == "1915-12-02T03:04:05.679Z"
    assert jd.utc_iso(places=4) == "1915-12-02T03:04:05.6787Z"
def test_iso_of_decimal_that_rounds_down():
    jd = JulianDate(utc=(2014, 12, 21, 6, 3, 1.234234))
    assert jd.utc_iso(places=0) == '2014-12-21T06:03:01Z'
    assert jd.utc_iso(places=1) == '2014-12-21T06:03:01.2Z'
    assert jd.utc_iso(places=2) == '2014-12-21T06:03:01.23Z'
    assert jd.utc_iso(places=3) == '2014-12-21T06:03:01.234Z'
    assert jd.utc_iso(places=4) == '2014-12-21T06:03:01.2342Z'
def test_iso_of_decimal_that_rounds_up():
    jd = JulianDate(utc=(1915, 12, 2, 3, 4, 5.6786786))
    assert jd.utc_iso(places=0) == '1915-12-02T03:04:06Z'
    assert jd.utc_iso(places=1) == '1915-12-02T03:04:05.7Z'
    assert jd.utc_iso(places=2) == '1915-12-02T03:04:05.68Z'
    assert jd.utc_iso(places=3) == '1915-12-02T03:04:05.679Z'
    assert jd.utc_iso(places=4) == '1915-12-02T03:04:05.6787Z'
def test_iso_of_array_showing_fractions():
    jd = JulianDate(utc=(1973, 12, 31, 23, 59, np.arange(58.75, 63.1, 0.5)))
    assert jd.utc_iso(places=2) == [
        "1973-12-31T23:59:58.75Z",
        "1973-12-31T23:59:59.25Z",
        "1973-12-31T23:59:59.75Z",
        "1973-12-31T23:59:60.25Z",
        "1973-12-31T23:59:60.75Z",
        "1974-01-01T00:00:00.25Z",
        "1974-01-01T00:00:00.75Z",
        "1974-01-01T00:00:01.25Z",
        "1974-01-01T00:00:01.75Z",
    ]
def test_iso_of_array_showing_whole_seconds():
    jd = JulianDate(utc=(1973, 12, 31, 23, 59, np.arange(58.75, 63.1, 0.5)))
    assert jd.utc_iso(places=0) == [
        "1973-12-31T23:59:59Z",
        "1973-12-31T23:59:59Z",
        "1973-12-31T23:59:60Z",
        "1973-12-31T23:59:60Z",
        "1974-01-01T00:00:00Z",
        "1974-01-01T00:00:00Z",
        "1974-01-01T00:00:01Z",
        "1974-01-01T00:00:01Z",
        "1974-01-01T00:00:02Z",
    ]
def test_iso_of_array_showing_fractions():
    jd = JulianDate(utc=(1973, 12, 31, 23, 59, np.arange(58.75, 63.1, 0.5)))
    assert jd.utc_iso(places=2) == [
        '1973-12-31T23:59:58.75Z',
        '1973-12-31T23:59:59.25Z',
        '1973-12-31T23:59:59.75Z',
        '1973-12-31T23:59:60.25Z',
        '1973-12-31T23:59:60.75Z',
        '1974-01-01T00:00:00.25Z',
        '1974-01-01T00:00:00.75Z',
        '1974-01-01T00:00:01.25Z',
        '1974-01-01T00:00:01.75Z',
    ]
def test_iso_of_array_showing_whole_seconds():
    jd = JulianDate(utc=(1973, 12, 31, 23, 59, np.arange(58.75, 63.1, 0.5)))
    assert jd.utc_iso(places=0) == [
        '1973-12-31T23:59:59Z',
        '1973-12-31T23:59:59Z',
        '1973-12-31T23:59:60Z',
        '1973-12-31T23:59:60Z',
        '1974-01-01T00:00:00Z',
        '1974-01-01T00:00:00Z',
        '1974-01-01T00:00:01Z',
        '1974-01-01T00:00:01Z',
        '1974-01-01T00:00:02Z',
    ]
def test_early_utc():
    jd = JulianDate(utc=(1915, 12, 2, 3, 4, 5.6786786))
    assert abs(jd.tt - 2420833.6283317441) < epsilon
    assert jd.utc_iso() == "1915-12-02T03:04:06Z"
def test_early_utc():
    jd = JulianDate(utc=(1915, 12, 2, 3, 4, 5.6786786))
    assert abs(jd.tt - 2420833.6283317441) < epsilon
    assert jd.utc_iso() == '1915-12-02T03:04:06Z'