Lines Matching refs:create_decimal
281 return self.readcontext.create_decimal(v)
388 funct(self.context.create_decimal(v))
397 v = self.context.create_decimal(v)
591 self.assertEqual(str(context.create_decimal(s)), '9.999999')
717 d = nc.create_decimal()
721 self.assertRaises(TypeError, nc.create_decimal, None)
724 d = nc.create_decimal(456)
726 self.assertEqual(nc.create_decimal(45678),
727 nc.create_decimal('457E+2'))
732 d = nc.create_decimal('456789')
737 self.assertEqual(str(nc.create_decimal('3.14\n')), 'NaN')
742 d = nc.create_decimal( (1, (4, 3, 4, 9, 1, 3, 5, 3, 4), -25) )
749 d = nc.create_decimal(prevdec)
758 d = nc.create_decimal(v)
764 self.assertRaises(Rounded, nc.create_decimal, 1234)
768 self.assertEqual(str(nc.create_decimal('0E-017')), '0E-17')
769 self.assertEqual(str(nc.create_decimal('45')), '45')
770 self.assertEqual(str(nc.create_decimal('-Inf')), '-Infinity')
771 self.assertEqual(str(nc.create_decimal('NaN123')), 'NaN123')
774 self.assertRaises(InvalidOperation, nc.create_decimal, "xyz")
775 self.assertRaises(ValueError, nc.create_decimal, (1, "xyz", -25))
776 self.assertRaises(TypeError, nc.create_decimal, "1234", "5678")
778 self.assertRaises(InvalidOperation, nc.create_decimal, " 1234")
779 self.assertRaises(InvalidOperation, nc.create_decimal, "12_34")
783 self.assertRaises(InvalidOperation, nc.create_decimal, 'NaN12345')
784 self.assertRaises(InvalidOperation, nc.create_decimal,
788 self.assertEqual(str(nc.create_decimal('NaN12345')), 'NaN')
792 self.assertEqual(str(nc.create_decimal(Decimal('NaN12345'))), 'NaN')
800 r = nc.create_decimal(0.1)
803 self.assertTrue(nc.create_decimal(float('nan')).is_qnan())
804 self.assertTrue(nc.create_decimal(float('inf')).is_infinite())
805 self.assertTrue(nc.create_decimal(float('-inf')).is_infinite())
806 self.assertEqual(str(nc.create_decimal(float('nan'))),
807 str(nc.create_decimal('NaN')))
808 self.assertEqual(str(nc.create_decimal(float('inf'))),
809 str(nc.create_decimal('Infinity')))
810 self.assertEqual(str(nc.create_decimal(float('-inf'))),
811 str(nc.create_decimal('-Infinity')))
812 self.assertEqual(str(nc.create_decimal(float('-0.0'))),
813 str(nc.create_decimal('-0')))
817 self.assertEqual(x, float(nc.create_decimal(x))) # roundtrip
3597 self.assertRaises(Clamped, c1.create_decimal, '0e-999')
3798 self.assertEqual(c.create_decimal(7.5), 7.5)
3824 self.assertRaises(FloatOperation, c.create_decimal, 7.5)
4181 x = c.create_decimal('1E222')
4473 self.assertRaises(ValueError, c.create_decimal, ["%"])
5406 self.assertEqual(str(c.create_decimal(x)), '-0E+999999')
5410 self.assertRaises(Overflow, c.create_decimal, x)
5415 self.assertEqual(str(c.create_decimal(x)), '-0E-1000007')
5419 self.assertRaises(Underflow, c.create_decimal, x)
5424 self.assertRaises(OverflowError, c.create_decimal, x)
5428 self.assertRaises(OverflowError, c.create_decimal, x)