Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_future.py @ 80661:94de77bd0b4b 2.7
Issue #16194: document imp.load_dynamic problems
when read several extension modules from the same binary object file.
| author | Andrew Svetlov <andrew.svetlov@gmail.com> |
|---|---|
| date | Thu, 29 Nov 2012 19:51:28 +0200 |
| parents | b36cb4602e21 |
| children |
| rev | line source |
|---|---|
|
16839
e1b1e68cbd8c
Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
1 # Test various flavors of legal and illegal future statements |
|
e1b1e68cbd8c
Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
2 |
|
31184
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
3 import unittest |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
4 from test import test_support |
|
16839
e1b1e68cbd8c
Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
5 import re |
|
e1b1e68cbd8c
Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
6 |
|
e1b1e68cbd8c
Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
7 rx = re.compile('\((\S+).py, line (\d+)') |
|
e1b1e68cbd8c
Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
8 |
|
31184
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
9 def get_error_location(msg): |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
10 mo = rx.search(str(msg)) |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
11 return mo.group(1, 2) |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
12 |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
13 class FutureTest(unittest.TestCase): |
|
16839
e1b1e68cbd8c
Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
14 |
|
31184
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
15 def test_future1(self): |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
16 test_support.unload('test_future1') |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
17 from test import test_future1 |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
18 self.assertEqual(test_future1.result, 6) |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
19 |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
20 def test_future2(self): |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
21 test_support.unload('test_future2') |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
22 from test import test_future2 |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
23 self.assertEqual(test_future2.result, 6) |
|
16839
e1b1e68cbd8c
Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
24 |
|
31184
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
25 def test_future3(self): |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
26 test_support.unload('test_future3') |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
27 from test import test_future3 |
|
16839
e1b1e68cbd8c
Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
28 |
|
31184
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
29 def test_badfuture3(self): |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
30 try: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
31 from test import badsyntax_future3 |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
32 except SyntaxError, msg: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
33 self.assertEqual(get_error_location(msg), ("badsyntax_future3", '3')) |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
34 else: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
35 self.fail("expected exception didn't occur") |
|
16839
e1b1e68cbd8c
Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
36 |
|
31184
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
37 def test_badfuture4(self): |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
38 try: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
39 from test import badsyntax_future4 |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
40 except SyntaxError, msg: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
41 self.assertEqual(get_error_location(msg), ("badsyntax_future4", '3')) |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
42 else: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
43 self.fail("expected exception didn't occur") |
|
19408
7e5e974b3d37
Fix SF bug [ #450245 ] Error in parsing future stmts
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
17558
diff
changeset
|
44 |
|
31184
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
45 def test_badfuture5(self): |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
46 try: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
47 from test import badsyntax_future5 |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
48 except SyntaxError, msg: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
49 self.assertEqual(get_error_location(msg), ("badsyntax_future5", '4')) |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
50 else: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
51 self.fail("expected exception didn't occur") |
|
16839
e1b1e68cbd8c
Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
52 |
|
31184
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
53 def test_badfuture6(self): |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
54 try: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
55 from test import badsyntax_future6 |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
56 except SyntaxError, msg: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
57 self.assertEqual(get_error_location(msg), ("badsyntax_future6", '3')) |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
58 else: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
59 self.fail("expected exception didn't occur") |
|
16839
e1b1e68cbd8c
Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
60 |
|
31184
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
61 def test_badfuture7(self): |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
62 try: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
63 from test import badsyntax_future7 |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
64 except SyntaxError, msg: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
65 self.assertEqual(get_error_location(msg), ("badsyntax_future7", '3')) |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
66 else: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
67 self.fail("expected exception didn't occur") |
|
16839
e1b1e68cbd8c
Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
68 |
|
31184
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
69 def test_badfuture8(self): |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
70 try: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
71 from test import badsyntax_future8 |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
72 except SyntaxError, msg: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
73 self.assertEqual(get_error_location(msg), ("badsyntax_future8", '3')) |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
74 else: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
75 self.fail("expected exception didn't occur") |
|
16839
e1b1e68cbd8c
Add regression test for future statements. This adds eight files, but
Jeremy Hylton <jeremy@alum.mit.edu>
parents:
diff
changeset
|
76 |
|
31184
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
77 def test_badfuture9(self): |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
78 try: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
79 from test import badsyntax_future9 |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
80 except SyntaxError, msg: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
81 self.assertEqual(get_error_location(msg), ("badsyntax_future9", '3')) |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
82 else: |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
83 self.fail("expected exception didn't occur") |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
84 |
|
39882
3478c160207b
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
85 def test_parserhack(self): |
|
3478c160207b
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
86 # test that the parser.c::future_hack function works as expected |
|
39881
25bcdf3cd194
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
87 # Note: although this test must pass, it's not testing the original |
|
25bcdf3cd194
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
88 # bug as of 2.6 since the with statement is not optional and |
|
25bcdf3cd194
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
89 # the parser hack disabled. If a new keyword is introduced in |
|
25bcdf3cd194
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
90 # 2.6, change this to refer to the new future import. |
|
39882
3478c160207b
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
91 try: |
|
49595
e80d9e6e26bb
Merged revisions 67030-67031 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
39881
diff
changeset
|
92 exec "from __future__ import print_function; print 0" |
|
39882
3478c160207b
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
93 except SyntaxError: |
|
3478c160207b
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
94 pass |
|
3478c160207b
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
95 else: |
|
3478c160207b
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
96 self.fail("syntax error didn't occur") |
|
3478c160207b
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
97 |
|
3478c160207b
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
98 try: |
|
49595
e80d9e6e26bb
Merged revisions 67030-67031 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
39881
diff
changeset
|
99 exec "from __future__ import (print_function); print 0" |
|
39882
3478c160207b
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
100 except SyntaxError: |
|
3478c160207b
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
101 pass |
|
3478c160207b
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
102 else: |
|
3478c160207b
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
103 self.fail("syntax error didn't occur") |
|
3478c160207b
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
104 |
|
49595
e80d9e6e26bb
Merged revisions 67030-67031 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
39881
diff
changeset
|
105 def test_multiple_features(self): |
|
e80d9e6e26bb
Merged revisions 67030-67031 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
39881
diff
changeset
|
106 test_support.unload("test.test_future5") |
|
e80d9e6e26bb
Merged revisions 67030-67031 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
39881
diff
changeset
|
107 from test import test_future5 |
|
e80d9e6e26bb
Merged revisions 67030-67031 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
39881
diff
changeset
|
108 |
|
49623
6cac2e3077a3
Merged revisions 67066 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
49595
diff
changeset
|
109 def test_unicode_literals_exec(self): |
|
6cac2e3077a3
Merged revisions 67066 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
49595
diff
changeset
|
110 scope = {} |
|
6cac2e3077a3
Merged revisions 67066 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
49595
diff
changeset
|
111 exec "from __future__ import unicode_literals; x = ''" in scope |
|
58472
6ffcdafa0118
use assert[Not]IsInstance where appropriate
Ezio Melotti <ezio.melotti@gmail.com>
parents:
49623
diff
changeset
|
112 self.assertIsInstance(scope["x"], unicode) |
|
49623
6cac2e3077a3
Merged revisions 67066 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
49595
diff
changeset
|
113 |
|
39882
3478c160207b
Fix a bug in the parser's future statement handling that led to "with"
Georg Brandl <georg@python.org>
parents:
31184
diff
changeset
|
114 |
|
31184
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
115 def test_main(): |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
116 test_support.run_unittest(FutureTest) |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
117 |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
118 if __name__ == "__main__": |
|
47eaa38b29cb
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
Neal Norwitz <nnorwitz@gmail.com>
parents:
24442
diff
changeset
|
119 test_main() |
