-
Notifications
You must be signed in to change notification settings - Fork 1
/
RomanNumeralsHelper_IVersion_4kyu_test.py
45 lines (29 loc) · 1.22 KB
/
RomanNumeralsHelper_IVersion_4kyu_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import unittest
from RomanNumeralsHelper_IVersion_4kyu import RomanNumerals
class TestToI(unittest.TestCase):
def testOneIsI(self):
self.assertEqual('I', RomanNumerals.to_i(1))
def testTenIsIIIIIIIIII(self):
self.assertEqual('IIIIIIIIII', RomanNumerals.to_i(10))
class TestToRoman(unittest.TestCase):
def testOneIsI(self):
self.assertEqual('I', RomanNumerals.to_roman(1))
def testThousandIsM(self):
self.assertEqual('M', RomanNumerals.to_roman(1000))
def testFourIsIV(self):
self.assertEqual('IV', RomanNumerals.to_roman(4))
def test1990IsMCMXC(self):
self.assertEqual('MCMXC', RomanNumerals.to_roman(1990))
def test2008IsMMVIII(self):
self.assertEqual('MMVIII', RomanNumerals.to_roman(2008))
class TestFromRoman(unittest.TestCase):
def testIIsOne(self):
self.assertEqual(1, RomanNumerals.from_roman('I'))
def testMIsThousand(self):
self.assertEqual(1000, RomanNumerals.from_roman('M'))
def testMCMXCIs1990(self):
self.assertEqual(1990, RomanNumerals.from_roman("MCMXC"))
def testMMVIIIIs2008(self):
self.assertEqual(2008, RomanNumerals.from_roman("MMVIII"))
if __name__ == '__main__':
unittest.main()