aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_builtin.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r--Lib/test/test_builtin.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 31597a320d4..8830641f0ab 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -393,7 +393,7 @@ class BuiltinTest(ComplexesAreIdenticalMixin, unittest.TestCase):
self.assertRaises(ValueError, chr, -2**1000)
def test_cmp(self):
- self.assertTrue(not hasattr(builtins, "cmp"))
+ self.assertNotHasAttr(builtins, "cmp")
def test_compile(self):
compile('print(1)\n', '', 'exec')
@@ -436,7 +436,7 @@ class BuiltinTest(ComplexesAreIdenticalMixin, unittest.TestCase):
# test both direct compilation and compilation via AST
codeobjs = []
codeobjs.append(compile(codestr, "<test>", "exec", optimize=optval))
- tree = ast.parse(codestr)
+ tree = ast.parse(codestr, optimize=optval)
codeobjs.append(compile(tree, "<test>", "exec", optimize=optval))
for code in codeobjs:
ns = {}
@@ -624,7 +624,7 @@ class BuiltinTest(ComplexesAreIdenticalMixin, unittest.TestCase):
for opt in [opt1, opt2]:
opt_right = opt.value.right
self.assertIsInstance(opt_right, ast.Constant)
- self.assertEqual(opt_right.value, True)
+ self.assertEqual(opt_right.value, __debug__)
def test_delattr(self):
sys.spam = 1
@@ -1120,6 +1120,7 @@ class BuiltinTest(ComplexesAreIdenticalMixin, unittest.TestCase):
self.check_iter_pickle(f1, list(f2), proto)
@support.skip_wasi_stack_overflow()
+ @support.skip_emscripten_stack_overflow()
@support.requires_resource('cpu')
def test_filter_dealloc(self):
# Tests recursive deallocation of nested filter objects using the
@@ -2303,7 +2304,7 @@ class BuiltinTest(ComplexesAreIdenticalMixin, unittest.TestCase):
# tests for object.__format__ really belong elsewhere, but
# there's no good place to put them
x = object().__format__('')
- self.assertTrue(x.startswith('<object object at'))
+ self.assertStartsWith(x, '<object object at')
# first argument to object.__format__ must be string
self.assertRaises(TypeError, object().__format__, 3)
@@ -2990,7 +2991,8 @@ class TestType(unittest.TestCase):
def load_tests(loader, tests, pattern):
from doctest import DocTestSuite
- tests.addTest(DocTestSuite(builtins))
+ if sys.float_repr_style == 'short':
+ tests.addTest(DocTestSuite(builtins))
return tests
if __name__ == "__main__":