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