示例#1
0
def test_bad_type():
    """is_roman_numeral should raise TypeError for non-string arguments"""
    for numeral in (None, 0, 1, 1.0):
        with pytest.raises(TypeError):
            Roman.is_roman_numeral(numeral)
    for obj in (None, 1.0):
        with pytest.raises(TypeError):
            Roman(numeral)
示例#2
0
def test_incorrect_numerals():
    """is_roman_numeral should return False for strings that are not roman numerals."""
    for numeral in incorrect_numerals:
        assert Roman.is_roman_numeral(numeral) == False

        with pytest.raises(ValueError):
            Roman(numeral)