コード例 #1
0
ファイル: romantest3.py プロジェクト: ksulrich/python
 def testFromRomanCase(self):
     """fromRoman should only accept uppercase input"""
     for integer in range(1, 4000):
         numeral = roman3.toRoman(integer)
         roman3.fromRoman(numeral.upper())
         self.assertRaises(roman3.InvalidRomanNumeralError,
                           roman3.fromRoman, numeral.lower())
コード例 #2
0
 def testFromRomanCase(self):
     """fromRoman should only accept uppercase input"""
     for integer in range(1, 4000):
         numeral = roman3.toRoman(integer)
         roman3.fromRoman(numeral.upper())
         self.assertRaises(roman3.InvalidRomanNumeralError,
                           roman3.fromRoman, numeral.lower())
コード例 #3
0
ファイル: romentest3.py プロジェクト: 4179e1/misc
	def testToRomanKnownValues (self):
		"""toRoman should give known result with known input"""
		for integer, numeral in self.knownValues:
			result = roman3.toRoman(integer)
			self.assertEqual (numeral, result)
コード例 #4
0
ファイル: romentest3.py プロジェクト: 4179e1/misc
	def testToRomanCase (self):
		"""toRoman should always return uppercase"""
		for integer in range (1, 5000):
			numeral = roman3.toRoman (integer)
			self.assertEqual (numeral, numeral.upper())
コード例 #5
0
ファイル: romentest3.py プロジェクト: 4179e1/misc
	def testSanity (self):
		"""fromRoman (toRoman(n)) == n for all n"""
		for integer in range (1, 5000):
			numeral = roman3.toRoman (integer)
			result = roman3.fromRoman (numeral)
			self.assertEqual (integer, result)
コード例 #6
0
 def testSanity(self):
     """fromRoman(toRoman(n))==n for all n"""
     for integer in range(1, 4000):
         numeral = roman3.toRoman(integer)
         result = roman3.fromRoman(numeral)
         self.assertEqual(integer, result)
コード例 #7
0
 def testToRomanKnownValues(self):
     """toRoman should give known result with known input"""
     for integer, numeral in self.knownValues:
         result = roman3.toRoman(integer)
         self.assertEqual(numeral, result)
コード例 #8
0
 def testToRomanCase(self):
     """toRoman should always return uppercase"""
     for integer in range(1, 4000):
         numeral = roman3.toRoman(integer)
         self.assertEqual(numeral, numeral.upper())