Exemplo n.º 1
0
 def assertAlmostEqual(self, v1, v2, *args, **kw):
     if (isinstance(v1, datatypes.decimal)
             or isinstance(v2, datatypes.decimal)):
         if not isinstance(v1, datatypes.decimal):
             v1 = datatypes.decimal(str(v1))
         if not isinstance(v2, datatypes.decimal):
             v2 = datatypes.decimal(str(v2))
     return super(testDigits, self).assertAlmostEqual(v1, v2, *args, **kw)
Exemplo n.º 2
0
 def testCreation(self):
     self.assertEqual(Decimal('100'), xsd.decimal('100.00'))
     self.assertEqual(Decimal('100'), xsd.decimal(100))
     self.assertEqual(Decimal('1.2'), xsd.decimal('1.2'))
     self.assertEqual(Decimal('1.2'), xsd.decimal(1.2))
     if sys.version_info[:2] >= (2, 7):
         self.assertNotEqual(Decimal('1.2'), Decimal(1.2))
     self.assertAlmostEqual(1.2, xsd.decimal(1.2))
Exemplo n.º 3
0
 def testCreation (self):
     self.assertEqual(Decimal('100'), xsd.decimal('100.00'))
     self.assertEqual(Decimal('100'), xsd.decimal(100))
     self.assertEqual(Decimal('1.2'), xsd.decimal('1.2'))
     self.assertEqual(Decimal('1.2'), xsd.decimal(1.2))
     if sys.version_info[:2] >= (2, 7):
         self.assertNotEqual(Decimal('1.2'), Decimal(1.2))
     self.assertAlmostEqual(1.2, xsd.decimal(1.2))
Exemplo n.º 4
0
 def assertAlmostEqual (self, v1, v2, *args, **kw):
     if (isinstance(v1, datatypes.decimal)
         or isinstance(v2, datatypes.decimal)):
         if not isinstance(v1, datatypes.decimal):
             v1 = datatypes.decimal(str(v1))
         if not isinstance(v2, datatypes.decimal):
             v2 = datatypes.decimal(str(v2))
     return super(testDigits, self).assertAlmostEqual(v1, v2, *args, **kw)
Exemplo n.º 5
0
 def testValidation(self):
     one = xsd.decimal('1')
     zero = xsd.decimal('0')
     self.assertTrue(one.validateBinding())
     self.assertTrue(zero.validateBinding())
     self.assertEqual('1.0', one.xsdLiteral())
Exemplo n.º 6
0
 def testValidation (self):
     one = xsd.decimal('1')
     zero = xsd.decimal('0')
     self.assertTrue(one.validateBinding())
     self.assertTrue(zero.validateBinding())
     self.assertEqual('1.0', one.xsdLiteral())