def test_900(self): roman = RomanNumConverter('CM') self.assertEqual(900, roman.to_integer())
def test_1990(self): roman = RomanNumConverter('MCMXC') self.assertEqual(1990, roman.to_integer())
def test_1066(self): roman = RomanNumConverter('MLXVI') self.assertEqual(1066, roman.to_integer())
def test_9(self): roman = RomanNumConverter('IX') self.assertEqual(9, roman.to_integer())
def test_four_combined(self): roman = RomanNumConverter('IIII') self.assertEqual(4, roman.to_integer())
def test_13(self): roman = RomanNumConverter('XIII') self.assertEqual(13, roman.to_integer())
def test_add_combined_romans_3(self): roman = RomanNumConverter('III') self.assertEqual(3, roman.to_integer())
def test_207(self): roman = RomanNumConverter('CCVII') self.assertEqual(207, roman.to_integer())
def test_four_combined_2(self): roman = RomanNumConverter('XXXX') self.assertEqual(40, roman.to_integer())
def test_subtract_combined_romans(self): roman = RomanNumConverter('IV') self.assertEqual(4, roman.to_integer())
def test_4(self): roman = RomanNumConverter('IV') self.assertEqual(4, roman.to_integer())
def test_single_char_roman_x(self): roman = RomanNumConverter('X') self.assertEqual(10, roman.to_integer())
def test_40(self): roman = RomanNumConverter('XL') self.assertEqual(40, roman.to_integer())
def test_1954(self): roman = RomanNumConverter('MCMLIV') self.assertEqual(1954, roman.to_integer())
def test_2014(self): roman = RomanNumConverter('MMXIV') self.assertEqual(2014, roman.to_integer())
from romans import RomanNumConverter from roman import toRoman with open('roman_numerals') as f: numerals = f.readlines() total_len_saved = 0 for num in numerals: num = num.rstrip() converted_num = toRoman(RomanNumConverter(num).to_integer()) total_len_saved += len(num) - len(converted_num) print(total_len_saved)