Пример #1
0
 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)
Пример #2
0
    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)
Пример #3
0
 def test_single_I(self):
     self.assertEqual(RomanToInt.convert('I'), 1)
Пример #4
0
 def test_composite_LXV(self):
     self.assertEqual(RomanToInt.convert('LXV'), 65)
Пример #5
0
 def test_composite_MMMD(self):
     self.assertEqual(RomanToInt.convert('MMMD'), 3500)
Пример #6
0
 def test_single_M(self):
     self.assertEqual(RomanToInt.convert('M'), 1000)
Пример #7
0
 def test_single_D(self):
     self.assertEqual(RomanToInt.convert('D'), 500)
Пример #8
0
 def test_single_L(self):
     self.assertEqual(RomanToInt.convert('L'), 50)
Пример #9
0
 def test_single_X(self):
     self.assertEqual(RomanToInt.convert('X'), 10)
Пример #10
0
 def test_single_V(self):
     self.assertEqual(RomanToInt.convert('V'), 5)