def test_from_roman_case(self): """from_roman should only accept uppercase input""" for integer in range(1, 5000): numeral = roman.to_roman(integer) roman.from_roman(numeral.upper()) self.assertRaises(roman.InvalidRomanNumeralError, roman.from_roman, numeral.lower())
def test_to_roman(self): """to_roman should give known result with known input""" for integer, numeral in self.known_values: result = roman.to_roman(integer) self.assertEqual(numeral, result)
def test_to_roman_case(self): """to_roman should always return uppercase""" for integer in range(1, 5000): numeral = roman.to_roman(integer) self.assertEqual(numeral, numeral.upper())
def test_round_trip(self): """from_roman(to_roman(n))==n for all n""" for integer in range(1, 5000): numeral = roman.to_roman(integer) result = roman.from_roman(numeral) self.assertEqual(integer, result)