コード例 #1
0
ファイル: test_months.py プロジェクト: t-reppert/bitesofpy
def test_non_int_input_args():
    with pytest.raises(TypeError):
        calc_months_passed('a', 10, 1)
    with pytest.raises(TypeError):
        calc_months_passed(2018, 'b', 1)
    with pytest.raises(TypeError):
        calc_months_passed(2018, 10, 'c')
コード例 #2
0
ファイル: test_months.py プロジェクト: t-reppert/bitesofpy
def test_out_of_dt_range_args():
    with pytest.raises(ValueError):
        calc_months_passed(-1000, 11, 1)
    with pytest.raises(ValueError):
        calc_months_passed(2018, 13, 1)
    with pytest.raises(ValueError):
        calc_months_passed(2018, 11, 34)
コード例 #3
0
ファイル: test_months.py プロジェクト: pogross/bitesofpy
def test_non_int_input_args():
    with pytest.raises(TypeError):
        calc_months_passed("a", 10, 1)
    with pytest.raises(TypeError):
        calc_months_passed(2018, "b", 1)
    with pytest.raises(TypeError):
        calc_months_passed(2018, 10, "c")
コード例 #4
0
ファイル: test_months.py プロジェクト: t-reppert/bitesofpy
def test_nine_days_later():
    assert calc_months_passed(2018, 11, 10) == 0
コード例 #5
0
ファイル: test_months.py プロジェクト: t-reppert/bitesofpy
def test_new_date_in_past_raises_value_error():
    with pytest.raises(ValueError):
        calc_months_passed(2018, 10, 1)
コード例 #6
0
ファイル: test_months.py プロジェクト: t-reppert/bitesofpy
def test_same_date():
    assert calc_months_passed(2018, 11, 1) == 0
コード例 #7
0
ファイル: test_months.py プロジェクト: t-reppert/bitesofpy
def test_one_year_one_month_and_ten_days_later():
    assert calc_months_passed(2019, 12, 11) == 14
コード例 #8
0
ファイル: test_months.py プロジェクト: t-reppert/bitesofpy
def test_one_year_one_month_and_nine_days_later():
    assert calc_months_passed(2019, 12, 10) == 13
コード例 #9
0
ファイル: test_months.py プロジェクト: t-reppert/bitesofpy
def test_one_month_and_ten_day_later():
    assert calc_months_passed(2018, 12, 11) == 2
コード例 #10
0
ファイル: test_months.py プロジェクト: t-reppert/bitesofpy
def test_ten_days_later():
    assert calc_months_passed(2018, 11, 11) == 1