示例#1
0
 def testFromRomanCase(self):
     """fromRoman should only accept uppercase input"""
     for integer in range(1, 4000):
         numeral = roman61.toRoman(integer)
         roman61.fromRoman(numeral.upper())
         self.assertRaises(roman61.InvalidRomanNumeralError,
                           roman61.fromRoman, numeral.lower())
 def testFromRomanCase(self):
     """fromRoman should only accept uppercase input"""
     for integer in range(1, 4000):
         numeral = roman61.toRoman(integer)
         roman61.fromRoman(numeral.upper())
         self.assertRaises(roman61.InvalidRomanNumeralError,
                           roman61.fromRoman, numeral.lower())
示例#3
0
 def testFromRomanKnownValues(self):
     """fromRoman should give known result with known input"""
     for integer, numeral in self.knownValues:
         result = roman61.fromRoman(numeral)
         self.assertEqual(integer, result)
示例#4
0
 def testSanity(self):
     """fromRoman(toRoman(n))==n for all n"""
     for integer in range(1, 4000):
         numeral = roman61.toRoman(integer)
         result = roman61.fromRoman(numeral)
         self.assertEqual(integer, result)
 def testSanity(self):
     """fromRoman(toRoman(n))==n for all n"""
     for integer in range(1, 4000):
         numeral = roman61.toRoman(integer)
         result = roman61.fromRoman(numeral)
         self.assertEqual(integer, result)
 def testFromRomanKnownValues(self):
     """fromRoman should give known result with known input"""
     for integer, numeral in self.knownValues:
         result = roman61.fromRoman(numeral)
         self.assertEqual(integer, result)