def testRom2Int(self): numeral = RomanNumerals() for integer, roman in self.goodValues: value = numeral.rom2int(roman) self.assertEqual(value, integer, "Failed rom2int with value %roman" %roman)
''' Created on Mar 19, 2012 @author: christom ''' from roman import RomanNumerals import sys if __name__ == '__main__': numeral = RomanNumerals() print "Welcome to the Roman Numeral converter..." data = "invalid" while (data != 'q'): print "Would you like to use..." data = str(input("1) int2rom \n2) rom2int \nq) Quit example \n")) if (data == "1"): value = input("Please input an integer: ") roman = numeral.int2rom(value) print(str(value) + " in Roman Numeral is " + str(roman)) elif (data == "2"): value = input("Please input an Roman numeral: ") integer = numeral.rom2int(value) print(str(value) + " in integer is " + str(integer)) elif (data == "q"): print "See ya!"
def testInt2Rom(self): numeral = RomanNumerals() for integer, roman in self.goodValues: value = numeral.int2rom(integer) self.assertEqual(value, roman, "Failed int2rom with value %integer" %integer)
def test_should_return_the_number_one(self): self.assertEqual(RomanNumerals.convert(1), 'I')