Exemple #1
0
 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())
Exemple #2
0
 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)
Exemple #3
0
 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())
Exemple #4
0
 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)