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