Example #1
0
 def testFromRomanCase(self):
     """fromRoman should only accept uppercase input"""
     for integer in range(1, 5000):
         numeral = roman81.toRoman(integer)
         roman81.fromRoman(numeral.upper())
         self.assertRaises(roman81.InvalidRomanNumeralError,
                           roman81.fromRoman, numeral.lower())
Example #2
0
 def testFromRomanCase(self):
     """fromRoman should only accept uppercase input"""
     for integer in range(1, 5000):
         numeral = roman81.toRoman(integer)
         roman81.fromRoman(numeral.upper())
         self.assertRaises(roman81.InvalidRomanNumeralError,
                           roman81.fromRoman, numeral.lower())
Example #3
0
 def testToRomanKnownValues(self):
     """toRoman should give known result with known input"""
     for integer, numeral in self.knownValues:
         result = roman81.toRoman(integer)
         self.assertEqual(numeral, result)
Example #4
0
 def testToRomanCase(self):
     """toRoman should always return uppercase"""
     for integer in range(1, 5000):
         numeral = roman81.toRoman(integer)
         self.assertEqual(numeral, numeral.upper())
Example #5
0
 def testSanity(self):
     """fromRoman(toRoman(n))==n for all n"""
     for integer in range(1, 5000):
         numeral = roman81.toRoman(integer)
         result = roman81.fromRoman(numeral)
         self.assertEqual(integer, result)
Example #6
0
 def testToRomanKnownValues(self):
     """toRoman should give known result with known input"""
     for integer, numeral in self.knownValues:
         result = roman81.toRoman(integer)
         self.assertEqual(numeral, result)
Example #7
0
 def testToRomanCase(self):
     """toRoman should always return uppercase"""
     for integer in range(1, 5000):
         numeral = roman81.toRoman(integer)
         self.assertEqual(numeral, numeral.upper())
Example #8
0
 def testSanity(self):
     """fromRoman(toRoman(n))==n for all n"""
     for integer in range(1, 5000):
         numeral = roman81.toRoman(integer)
         result = roman81.fromRoman(numeral)
         self.assertEqual(integer, result)