예제 #1
0
def test_add_one_day():
    ref_day = st.StarDate(2070)
    assert 1 == ref_day.month
    assert 1 == ref_day.day
    later_day = ref_day + 1
    assert 2070 == later_day.year
    assert 2 == later_day.day
예제 #2
0
def test_next_year():
    ref_day = st.StarDate(2080)
    later_day = ref_day + 360
    assert 2081 == later_day.year
    assert 1 == later_day.month
    assert 1 == later_day.day
예제 #3
0
def test_add_one_day_later_year():
    ref_day = st.StarDate(2080)
    later_day = ref_day + 1
    assert 2080 == later_day.year
    assert 1 == later_day.month
    assert 2 == later_day.day
예제 #4
0
def test_add_more_than_a_month():
    ref_day = st.StarDate(2080)
    later_day = ref_day + 46
    assert 2080 == later_day.year
    assert 2 == later_day.month
    assert 17 == later_day.day
예제 #5
0
def test_creation_with_day():
    date = st.StarDate(2070, day=20)
    assert 2070 == date.year
    assert 1 == date.month
    assert 20 == date.day
예제 #6
0
def test_creation_with_only_year_is_first_day():
    date = st.StarDate(2070)
    assert 1 == date.month
    assert 1 == date.day
예제 #7
0
def test_creation_with_other_year():
    date = st.StarDate(2080)
    assert 2080 == date.year
    assert 1 == date.month
    assert 1 == date.day
예제 #8
0
def test_creation_with_month():
    date = st.StarDate(2070, 5)
    assert 2070 == date.year
    assert 5 == date.month
    assert 1 == date.day
예제 #9
0
def test_with_inconsistent_day():
    with pytest.raises(ValueError):
        st.StarDate(day=0)

    with pytest.raises(ValueError):
        st.StarDate(day=34)
예제 #10
0
def test_with_inconsistent_month():
    with pytest.raises(ValueError):
        st.StarDate(month=0)

    with pytest.raises(ValueError):
        st.StarDate(month=15)
예제 #11
0
def test_with_early_year():
    with pytest.raises(ValueError):
        st.StarDate(2060)
예제 #12
0
def test_start_location_none():
    ship = m.Ship(None, m.StarDate())
    assert ship.star is None
예제 #13
0
def test_can_set_location():
    ship = m.Ship(None, m.StarDate())
    ship.location = "here"
    assert "here" == ship.star
    assert "here" == ship.location