def test_double_x(self): self.assertEqual(RomanToInt.convert('III'), 3) self.assertEqual(RomanToInt.convert('IV'), 4) self.assertEqual(RomanToInt.convert('IX'), 9) self.assertEqual(RomanToInt.convert('XX'), 20) self.assertEqual(RomanToInt.convert('XXVII'), 27) self.assertEqual(RomanToInt.convert('XXX'), 30) self.assertEqual(RomanToInt.convert('XL'), 40) self.assertEqual(RomanToInt.convert('XC'), 90)
def test_single_x(self): lst_letter = ['I', 'V', 'X', 'L', 'C', 'D', 'M'] lst_number = [1, 5, 10, 50, 100, 500, 1000] for letter, number in zip(lst_letter, lst_number): self.assertEqual(RomanToInt.convert(letter), number)
def test_single_I(self): self.assertEqual(RomanToInt.convert('I'), 1)
def test_composite_LXV(self): self.assertEqual(RomanToInt.convert('LXV'), 65)
def test_composite_MMMD(self): self.assertEqual(RomanToInt.convert('MMMD'), 3500)
def test_single_M(self): self.assertEqual(RomanToInt.convert('M'), 1000)
def test_single_D(self): self.assertEqual(RomanToInt.convert('D'), 500)
def test_single_L(self): self.assertEqual(RomanToInt.convert('L'), 50)
def test_single_X(self): self.assertEqual(RomanToInt.convert('X'), 10)
def test_single_V(self): self.assertEqual(RomanToInt.convert('V'), 5)