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