Python test.test_support.cpython_only() Examples
The following are 3
code examples of test.test_support.cpython_only().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
test.test_support
, or try the search function
.
Example #1
Source File: test_format.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_main(): test_support.run_unittest(FormatTest) def test_precision(self): f = 1.2 self.assertEqual(format(f, ".0f"), "1") self.assertEqual(format(f, ".3f"), "1.200") with self.assertRaises(ValueError) as cm: format(f, ".%sf" % (sys.maxsize + 1)) self.assertEqual(str(cm.exception), "precision too big") c = complex(f) self.assertEqual(format(c, ".0f"), "1+0j") self.assertEqual(format(c, ".3f"), "1.200+0.000j") with self.assertRaises(ValueError) as cm: format(c, ".%sf" % (sys.maxsize + 1)) self.assertEqual(str(cm.exception), "precision too big") @test_support.cpython_only def test_precision_c_limits(self): from _testcapi import INT_MAX f = 1.2 with self.assertRaises(ValueError) as cm: format(f, ".%sf" % (INT_MAX + 1)) c = complex(f) with self.assertRaises(ValueError) as cm: format(c, ".%sf" % (INT_MAX + 1))
Example #2
Source File: test_format.py From oss-ftp with MIT License | 5 votes |
def test_main(): test_support.run_unittest(FormatTest) def test_precision(self): f = 1.2 self.assertEqual(format(f, ".0f"), "1") self.assertEqual(format(f, ".3f"), "1.200") with self.assertRaises(ValueError) as cm: format(f, ".%sf" % (sys.maxsize + 1)) self.assertEqual(str(cm.exception), "precision too big") c = complex(f) self.assertEqual(format(c, ".0f"), "1+0j") self.assertEqual(format(c, ".3f"), "1.200+0.000j") with self.assertRaises(ValueError) as cm: format(c, ".%sf" % (sys.maxsize + 1)) self.assertEqual(str(cm.exception), "precision too big") @test_support.cpython_only def test_precision_c_limits(self): from _testcapi import INT_MAX f = 1.2 with self.assertRaises(ValueError) as cm: format(f, ".%sf" % (INT_MAX + 1)) c = complex(f) with self.assertRaises(ValueError) as cm: format(c, ".%sf" % (INT_MAX + 1))
Example #3
Source File: test_format.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_main(): test_support.run_unittest(FormatTest) def test_precision(self): f = 1.2 self.assertEqual(format(f, ".0f"), "1") self.assertEqual(format(f, ".3f"), "1.200") with self.assertRaises(ValueError) as cm: format(f, ".%sf" % (sys.maxsize + 1)) self.assertEqual(str(cm.exception), "precision too big") c = complex(f) self.assertEqual(format(c, ".0f"), "1+0j") self.assertEqual(format(c, ".3f"), "1.200+0.000j") with self.assertRaises(ValueError) as cm: format(c, ".%sf" % (sys.maxsize + 1)) self.assertEqual(str(cm.exception), "precision too big") @test_support.cpython_only def test_precision_c_limits(self): from _testcapi import INT_MAX f = 1.2 with self.assertRaises(ValueError) as cm: format(f, ".%sf" % (INT_MAX + 1)) c = complex(f) with self.assertRaises(ValueError) as cm: format(c, ".%sf" % (INT_MAX + 1))