summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/pickletester.py24
-rw-r--r--Lib/test/test_compile.py8
-rw-r--r--Lib/test/test_exceptions.py2
-rw-r--r--Lib/test/test_gettext.py8
-rw-r--r--Lib/test/test_inspect.py4
-rw-r--r--Lib/test/test_iterlen.py2
-rw-r--r--Lib/test/test_pep352.py8
-rw-r--r--Lib/test/test_site.py20
-rw-r--r--Lib/test/test_sys.py10
-rw-r--r--Lib/test/test_traceback.py2
10 files changed, 44 insertions, 44 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index 6db3572..b20f599 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -91,7 +91,7 @@ class use_metaclass(object, metaclass=metaclass):
DATA0 = (
b'(lp0\nL0\naL1\naF2.0\nac'
- b'__builtin__\ncomplex\n'
+ b'builtins\ncomplex\n'
b'p1\n(F3.0\nF0.0\ntp2\nRp'
b'3\naL1\naL-1\naL255\naL-'
b'255\naL-256\naL65535\na'
@@ -100,8 +100,8 @@ DATA0 = (
b'647\naL-2147483648\na('
b'Vabc\np4\ng4\nccopy_reg'
b'\n_reconstructor\np5\n('
- b'c__main__\nC\np6\nc__bu'
- b'iltin__\nobject\np7\nNt'
+ b'c__main__\nC\np6\ncbu'
+ b'iltins\nobject\np7\nNt'
b'p8\nRp9\n(dp10\nVfoo\np1'
b'1\nL1\nsVbar\np12\nL2\nsb'
b'g9\ntp13\nag13\naL5\na.'
@@ -118,7 +118,7 @@ DATA0_DIS = """\
12: a APPEND
13: F FLOAT 2.0
18: a APPEND
- 19: c GLOBAL '__builtin__ complex'
+ 19: c GLOBAL 'builtins complex'
40: p PUT 1
43: ( MARK
44: F FLOAT 3.0
@@ -159,7 +159,7 @@ DATA0_DIS = """\
199: ( MARK
200: c GLOBAL '__main__ C'
212: p PUT 6
- 215: c GLOBAL '__builtin__ object'
+ 215: c GLOBAL 'builtins object'
235: p PUT 7
238: N NONE
239: t TUPLE (MARK at 199)
@@ -191,15 +191,15 @@ highest protocol among opcodes = 0
"""
DATA1 = (
- b']q\x00(K\x00K\x01G@\x00\x00\x00\x00\x00\x00\x00c__'
- b'builtin__\ncomplex\nq\x01'
+ b']q\x00(K\x00K\x01G@\x00\x00\x00\x00\x00\x00\x00c'
+ b'builtins\ncomplex\nq\x01'
b'(G@\x08\x00\x00\x00\x00\x00\x00G\x00\x00\x00\x00\x00\x00\x00\x00t'
b'q\x02Rq\x03K\x01J\xff\xff\xff\xffK\xffJ\x01\xff\xff\xffJ'
b'\x00\xff\xff\xffM\xff\xffJ\x01\x00\xff\xffJ\x00\x00\xff\xffJ\xff\xff'
b'\xff\x7fJ\x01\x00\x00\x80J\x00\x00\x00\x80(X\x03\x00\x00\x00ab'
b'cq\x04h\x04ccopy_reg\n_reco'
b'nstructor\nq\x05(c__main'
- b'__\nC\nq\x06c__builtin__\n'
+ b'__\nC\nq\x06cbuiltins\n'
b'object\nq\x07Ntq\x08Rq\t}q\n('
b'X\x03\x00\x00\x00fooq\x0bK\x01X\x03\x00\x00\x00bar'
b'q\x0cK\x02ubh\ttq\rh\rK\x05e.'
@@ -213,7 +213,7 @@ DATA1_DIS = """\
4: K BININT1 0
6: K BININT1 1
8: G BINFLOAT 2.0
- 17: c GLOBAL '__builtin__ complex'
+ 17: c GLOBAL 'builtins complex'
38: q BINPUT 1
40: ( MARK
41: G BINFLOAT 3.0
@@ -242,7 +242,7 @@ DATA1_DIS = """\
152: ( MARK
153: c GLOBAL '__main__ C'
165: q BINPUT 6
- 167: c GLOBAL '__builtin__ object'
+ 167: c GLOBAL 'builtins object'
187: q BINPUT 7
189: N NONE
190: t TUPLE (MARK at 152)
@@ -272,7 +272,7 @@ highest protocol among opcodes = 1
DATA2 = (
b'\x80\x02]q\x00(K\x00K\x01G@\x00\x00\x00\x00\x00\x00\x00c'
- b'__builtin__\ncomplex\n'
+ b'builtins\ncomplex\n'
b'q\x01G@\x08\x00\x00\x00\x00\x00\x00G\x00\x00\x00\x00\x00\x00\x00\x00'
b'\x86q\x02Rq\x03K\x01J\xff\xff\xff\xffK\xffJ\x01\xff\xff\xff'
b'J\x00\xff\xff\xffM\xff\xffJ\x01\x00\xff\xffJ\x00\x00\xff\xffJ\xff'
@@ -292,7 +292,7 @@ DATA2_DIS = """\
6: K BININT1 0
8: K BININT1 1
10: G BINFLOAT 2.0
- 19: c GLOBAL '__builtin__ complex'
+ 19: c GLOBAL 'builtins complex'
40: q BINPUT 1
42: G BINFLOAT 3.0
51: G BINFLOAT 0.0
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index e7ffc02..cc490d7 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -7,10 +7,10 @@ class TestSpecifics(unittest.TestCase):
def test_debug_assignment(self):
# catch assignments to __debug__
self.assertRaises(SyntaxError, compile, '__debug__ = 1', '?', 'single')
- import __builtin__
- prev = __builtin__.__debug__
- setattr(__builtin__, '__debug__', 'sure')
- setattr(__builtin__, '__debug__', prev)
+ import builtins
+ prev = builtins.__debug__
+ setattr(builtins, '__debug__', 'sure')
+ setattr(builtins, '__debug__', prev)
def test_argument_handling(self):
# detect duplicate positional and keyword arguments
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index d1f9b1a..ae4687f 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -288,7 +288,7 @@ class ExceptionTests(unittest.TestCase):
raise
else:
# Verify module name
- self.assertEquals(type(e).__module__, '__builtin__')
+ self.assertEquals(type(e).__module__, 'builtins')
# Verify no ref leaks in Exc_str()
s = str(e)
for checkArgName in expected:
diff --git a/Lib/test/test_gettext.py b/Lib/test/test_gettext.py
index 12a657c..a875272 100644
--- a/Lib/test/test_gettext.py
+++ b/Lib/test/test_gettext.py
@@ -146,13 +146,13 @@ trggrkg zrffntr pngnybt yvoenel.''')
t.install(str=True)
eq(_('mullusk'), 'bacon')
# Test installation of other methods
- import __builtin__
+ import builtins
t.install(str=True, names=["gettext", "lgettext"])
eq(_, t.ugettext)
- eq(__builtin__.gettext, t.ugettext)
+ eq(builtins.gettext, t.ugettext)
eq(lgettext, t.lgettext)
- del __builtin__.gettext
- del __builtin__.lgettext
+ del builtins.gettext
+ del builtins.lgettext
class GettextTestCase2(GettextBaseTest):
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 60a7ad1..75e66ed 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -29,7 +29,7 @@ modfile = normcase(modfile)
def revise(filename, *args):
return (normcase(filename),) + args
-import __builtin__
+import builtins
try:
1/0
@@ -197,7 +197,7 @@ class TestRetrievingSourceCode(GetSourceBase):
# Do it again (check the caching isn't broken)
self.assertEqual(inspect.getmodule(mod.StupidGit.abuse), mod)
# Check a builtin
- self.assertEqual(inspect.getmodule(str), sys.modules["__builtin__"])
+ self.assertEqual(inspect.getmodule(str), sys.modules["builtins"])
# Check filename override
self.assertEqual(inspect.getmodule(None, modfile), mod)
diff --git a/Lib/test/test_iterlen.py b/Lib/test/test_iterlen.py
index afd7287..93b77b6 100644
--- a/Lib/test/test_iterlen.py
+++ b/Lib/test/test_iterlen.py
@@ -46,7 +46,7 @@ from test import test_support
from itertools import repeat
from collections import deque
from UserList import UserList
-from __builtin__ import len as _len
+from builtins import len as _len
n = 10
diff --git a/Lib/test/test_pep352.py b/Lib/test/test_pep352.py
index ddeee1a..db117ef 100644
--- a/Lib/test/test_pep352.py
+++ b/Lib/test/test_pep352.py
@@ -1,5 +1,5 @@
import unittest
-import __builtin__
+import builtins
import warnings
from test.test_support import run_unittest
import os
@@ -23,7 +23,7 @@ class ExceptionClassTests(unittest.TestCase):
def test_inheritance(self):
# Make sure the inheritance hierarchy matches the documentation
exc_set = set()
- for object_ in __builtin__.__dict__.values():
+ for object_ in builtins.__dict__.values():
try:
if issubclass(object_, BaseException):
exc_set.add(object_.__name__)
@@ -35,7 +35,7 @@ class ExceptionClassTests(unittest.TestCase):
try:
superclass_name = inheritance_tree.readline().rstrip()
try:
- last_exc = getattr(__builtin__, superclass_name)
+ last_exc = getattr(builtins, superclass_name)
except AttributeError:
self.fail("base class %s not a built-in" % superclass_name)
self.failUnless(superclass_name in exc_set,
@@ -58,7 +58,7 @@ class ExceptionClassTests(unittest.TestCase):
left_bracket = exc_name.index('[')
exc_name = exc_name[:left_bracket-1] # cover space
try:
- exc = getattr(__builtin__, exc_name)
+ exc = getattr(builtins, exc_name)
except AttributeError:
self.fail("%s not a built-in exception" % exc_name)
if last_depth < depth:
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index 11bb674..4624ea6 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -6,7 +6,7 @@ executing have not been removed.
"""
import unittest
from test.test_support import TestSkipped, TestFailed, run_unittest, TESTFN
-import __builtin__
+import builtins
import os
import sys
import encodings
@@ -162,7 +162,7 @@ class ImportSideEffectTests(unittest.TestCase):
# as an absolute path.
# Handled by abs__file__()
site.abs__file__()
- for module in (sys, os, __builtin__):
+ for module in (sys, os, builtins):
try:
self.failUnless(os.path.isabs(module.__file__), repr(module))
except AttributeError:
@@ -187,18 +187,18 @@ class ImportSideEffectTests(unittest.TestCase):
pass
def test_setting_quit(self):
- # 'quit' and 'exit' should be injected into __builtin__
- self.failUnless(hasattr(__builtin__, "quit"))
- self.failUnless(hasattr(__builtin__, "exit"))
+ # 'quit' and 'exit' should be injected into builtins
+ self.failUnless(hasattr(builtins, "quit"))
+ self.failUnless(hasattr(builtins, "exit"))
def test_setting_copyright(self):
- # 'copyright' and 'credits' should be in __builtin__
- self.failUnless(hasattr(__builtin__, "copyright"))
- self.failUnless(hasattr(__builtin__, "credits"))
+ # 'copyright' and 'credits' should be in builtins
+ self.failUnless(hasattr(builtins, "copyright"))
+ self.failUnless(hasattr(builtins, "credits"))
def test_setting_help(self):
- # 'help' should be set in __builtin__
- self.failUnless(hasattr(__builtin__, "help"))
+ # 'help' should be set in builtins
+ self.failUnless(hasattr(builtins, "help"))
def test_aliasing_mbcs(self):
if sys.platform == "win32":
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 767f3a8..435a696 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -15,22 +15,22 @@ class SysModuleTest(unittest.TestCase):
sys.displayhook = self.orig_displayhook
def test_original_displayhook(self):
- import __builtin__
+ import builtins
out = io.StringIO()
sys.stdout = out
dh = sys.__displayhook__
self.assertRaises(TypeError, dh)
- if hasattr(__builtin__, "_"):
- del __builtin__._
+ if hasattr(builtins, "_"):
+ del builtins._
dh(None)
self.assertEqual(out.getvalue(), "")
- self.assert_(not hasattr(__builtin__, "_"))
+ self.assert_(not hasattr(builtins, "_"))
dh(42)
self.assertEqual(out.getvalue(), "42\n")
- self.assertEqual(__builtin__._, 42)
+ self.assertEqual(builtins._, 42)
del sys.stdout
self.assertRaises(RuntimeError, dh, 42)
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index 36ea067..93e5126 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -65,7 +65,7 @@ class TracebackCases(unittest.TestCase):
err = traceback.format_exception_only(X, X())
self.assertEqual(len(err), 1)
str_value = '<unprintable %s object>' % X.__name__
- if X.__module__ in ('__main__', '__builtin__'):
+ if X.__module__ in ('__main__', 'builtins'):
str_name = X.__name__
else:
str_name = '.'.join([X.__module__, X.__name__])