Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #6
0
def test_creation_with_only_year_is_first_day():
    date = st.StarDate(2070)
    assert 1 == date.month
    assert 1 == date.day
Exemple #7
0
def test_creation_with_other_year():
    date = st.StarDate(2080)
    assert 2080 == date.year
    assert 1 == date.month
    assert 1 == date.day
Exemple #8
0
def test_creation_with_month():
    date = st.StarDate(2070, 5)
    assert 2070 == date.year
    assert 5 == date.month
    assert 1 == date.day
Exemple #9
0
def test_with_inconsistent_day():
    with pytest.raises(ValueError):
        st.StarDate(day=0)

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

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