Beispiel #1
0
 def testConvertOneDecimal(self):
     convert = Convert(1)
     self.assertEqual(10, convert('1'))
     self.assertEqual(10, convert('1.0'))
     self.assertEqual(10, convert('1.0456789'))
     self.assertEqual(10, convert('0.9999999'))
     self.assertEqual(9, convert('0.945'))
Beispiel #2
0
 def testConvertNoDecimal(self):
     convert = Convert(0)
     self.assertEqual(1, convert('1.0'))
     self.assertEqual(1, convert('1.0456789'))
     self.assertEqual(1, convert('0.9999999'))
     self.assertEqual(1, convert('1'))
     self.assertEqual(1, convert('0.5'))
     self.assertEqual(1, convert('1.4456789'))
     self.assertEqual(2, convert('1.945'))
     self.assertEqual(2, convert('1.5'))
     self.assertEqual(2, convert('2.4456789'))
Beispiel #3
0
 def testStrangeNumbers(self):
     convert = Convert(1)
     self.assertEqual(50, convert('05.0'))
     self.assertEqual(70, convert('007'))
     self.assertEqual(0, convert('-000'))
Beispiel #4
0
 def testConvertDecimalMinus1(self):
     convert = Convert(-1)
     self.assertEqual(0, convert('1.0'))
     self.assertEqual(1, convert('11.0456789'))
     self.assertEqual(0, convert('0.9999999'))
     self.assertEqual(2, convert('19.45'))