def test_to_roman_known_values(self): '''to_roman should give known result with known input''' for integer, numeral in self.known_values: result = to_roman(integer) self.assertEqual(numeral, result)
def test_to_roman_raises_not_integer_error_for_(self): self.assertRaises(NotIntegerError, lambda: to_roman('#'))
def test_to_roman_returns_x_for_10(self): self.assertEqual('x', to_roman(10))
def test_roundtrip(self): """from_roman(to_roman(n))==n for all n""" for integer in range(1, 5000): numeral = to_roman(integer) result = from_roman(numeral) self.assertEqual(integer, result)