Esempio n. 1
0
 def testDontConvert(self):
     self.assertEquals(compat.TryToRoman(0, convert=False), 0)
     self.assertEquals(compat.TryToRoman(1, convert=False), 1)
     self.assertEquals(compat.TryToRoman(7, convert=False), 7)
     self.assertEquals(compat.TryToRoman("astring", convert=False),
                       "astring")
     self.assertEquals(compat.TryToRoman("19", convert=False), "19")
Esempio n. 2
0
 def testAFewIntegers(self):
     # This test only works is the roman module is installed
     if compat.roman is not None:
         self.assertEquals(compat.TryToRoman(0), 0)
         self.assertEquals(compat.TryToRoman(1), "I")
         self.assertEquals(compat.TryToRoman(4), "IV")
         self.assertEquals(compat.TryToRoman(5), "V")
Esempio n. 3
0
 def testWithNoRoman(self):
     # compat.roman is saved/restored in setUp/tearDown
     compat.roman = None
     self.assertEquals(compat.TryToRoman(0), 0)
     self.assertEquals(compat.TryToRoman(1), 1)
     self.assertEquals(compat.TryToRoman(4), 4)
     self.assertEquals(compat.TryToRoman(5), 5)
Esempio n. 4
0
 def testAFewIntegers(self):
     # This test only works is the roman module is installed
     if compat.roman is not None:
         # starting with roman 3.2 single-digit 0 now converts to 'N' instead of 0
         self.assertIn(compat.TryToRoman(0), [0, 'N'])
         self.assertEqual(compat.TryToRoman(1), "I")
         self.assertEqual(compat.TryToRoman(4), "IV")
         self.assertEqual(compat.TryToRoman(5), "V")
Esempio n. 5
0
 def testStrings(self):
     self.assertEquals(compat.TryToRoman("astring"), "astring")
     self.assertEquals(compat.TryToRoman("5"), "5")