Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_future.py @ 87690:66c1c9f32567 default tip
Add use_weakref option to functools.lru_cache
The use_weakref option makes lru_cache create weak references to the function
arguments when creating the cache key, which prevents them from staying in the
memory forever even after all other references to them are gone.
This is a proof of concept for http://bugs.python.org/issue19859
| author | Radomir Dopieralski <devel@sheep.art.pl> |
|---|---|
| date | Tue, 03 Dec 2013 16:02:48 +0100 |
| parents | 46cadd3955d0 |
| 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 |
|
47201
9c930a32cebb
#2621 rename test.test_support to test.support
Benjamin Peterson <benjamin@python.org>
parents:
40587
diff
changeset
|
4 from test import 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): |
|
82409
83ae10bf608c
#17303: test_future* now work with unittest test discovery. Patch by Zachary Ware.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
68905
diff
changeset
|
16 with support.CleanImport('future_test1'): |
|
83ae10bf608c
#17303: test_future* now work with unittest test discovery. Patch by Zachary Ware.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
68905
diff
changeset
|
17 from test import future_test1 |
|
83ae10bf608c
#17303: test_future* now work with unittest test discovery. Patch by Zachary Ware.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
68905
diff
changeset
|
18 self.assertEqual(future_test1.result, 6) |
|
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
|
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): |
|
82409
83ae10bf608c
#17303: test_future* now work with unittest test discovery. Patch by Zachary Ware.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
68905
diff
changeset
|
21 with support.CleanImport('future_test2'): |
|
83ae10bf608c
#17303: test_future* now work with unittest test discovery. Patch by Zachary Ware.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
68905
diff
changeset
|
22 from test import future_test2 |
|
83ae10bf608c
#17303: test_future* now work with unittest test discovery. Patch by Zachary Ware.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
68905
diff
changeset
|
23 self.assertEqual(future_test2.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): |
|
82409
83ae10bf608c
#17303: test_future* now work with unittest test discovery. Patch by Zachary Ware.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
68905
diff
changeset
|
26 with support.CleanImport('test_future3'): |
|
83ae10bf608c
#17303: test_future* now work with unittest test discovery. Patch by Zachary Ware.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
68905
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 |
|
40587
6b18a095c2e7
SF patch 1631942 by Collin Winter:
Guido van Rossum <guido@python.org>
parents:
40450
diff
changeset
|
32 except SyntaxError as msg: |
|
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
|
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 |
|
40587
6b18a095c2e7
SF patch 1631942 by Collin Winter:
Guido van Rossum <guido@python.org>
parents:
40450
diff
changeset
|
40 except SyntaxError as msg: |
|
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
|
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 |
|
40587
6b18a095c2e7
SF patch 1631942 by Collin Winter:
Guido van Rossum <guido@python.org>
parents:
40450
diff
changeset
|
48 except SyntaxError as msg: |
|
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
|
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 |
|
40587
6b18a095c2e7
SF patch 1631942 by Collin Winter:
Guido van Rossum <guido@python.org>
parents:
40450
diff
changeset
|
56 except SyntaxError as msg: |
|
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
|
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 |
|
40587
6b18a095c2e7
SF patch 1631942 by Collin Winter:
Guido van Rossum <guido@python.org>
parents:
40450
diff
changeset
|
64 except SyntaxError as msg: |
|
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
|
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 |
|
40587
6b18a095c2e7
SF patch 1631942 by Collin Winter:
Guido van Rossum <guido@python.org>
parents:
40450
diff
changeset
|
72 except SyntaxError as msg: |
|
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
|
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 |
|
40587
6b18a095c2e7
SF patch 1631942 by Collin Winter:
Guido van Rossum <guido@python.org>
parents:
40450
diff
changeset
|
80 except SyntaxError as msg: |
|
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
|
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 |
|
82687
46cadd3955d0
reject non-docs strings between future imports (closes #17434)
Benjamin Peterson <benjamin@python.org>
parents:
82409
diff
changeset
|
85 def test_badfuture10(self): |
|
46cadd3955d0
reject non-docs strings between future imports (closes #17434)
Benjamin Peterson <benjamin@python.org>
parents:
82409
diff
changeset
|
86 try: |
|
46cadd3955d0
reject non-docs strings between future imports (closes #17434)
Benjamin Peterson <benjamin@python.org>
parents:
82409
diff
changeset
|
87 from test import badsyntax_future10 |
|
46cadd3955d0
reject non-docs strings between future imports (closes #17434)
Benjamin Peterson <benjamin@python.org>
parents:
82409
diff
changeset
|
88 except SyntaxError as msg: |
|
46cadd3955d0
reject non-docs strings between future imports (closes #17434)
Benjamin Peterson <benjamin@python.org>
parents:
82409
diff
changeset
|
89 self.assertEqual(get_error_location(msg), ("badsyntax_future10", '3')) |
|
46cadd3955d0
reject non-docs strings between future imports (closes #17434)
Benjamin Peterson <benjamin@python.org>
parents:
82409
diff
changeset
|
90 else: |
|
46cadd3955d0
reject non-docs strings between future imports (closes #17434)
Benjamin Peterson <benjamin@python.org>
parents:
82409
diff
changeset
|
91 self.fail("expected exception didn't occur") |
|
46cadd3955d0
reject non-docs strings between future imports (closes #17434)
Benjamin Peterson <benjamin@python.org>
parents:
82409
diff
changeset
|
92 |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
93 def test_parserhack(self): |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
94 # test that the parser.c::future_hack function works as expected |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
95 # Note: although this test must pass, it's not testing the original |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
96 # bug as of 2.6 since the with statement is not optional and |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
97 # the parser hack disabled. If a new keyword is introduced in |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
98 # 2.6, change this to refer to the new future import. |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
99 try: |
|
49594
30c0b266af06
Merged revisions 67030-67031 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
100 exec("from __future__ import print_function; print 0") |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
101 except SyntaxError: |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
102 pass |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
103 else: |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
104 self.fail("syntax error didn't occur") |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
105 |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
106 try: |
|
49594
30c0b266af06
Merged revisions 67030-67031 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
107 exec("from __future__ import (print_function); print 0") |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
108 except SyntaxError: |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
109 pass |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
110 else: |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
111 self.fail("syntax error didn't occur") |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
112 |
|
49594
30c0b266af06
Merged revisions 67030-67031 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
113 def test_multiple_features(self): |
|
82409
83ae10bf608c
#17303: test_future* now work with unittest test discovery. Patch by Zachary Ware.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
68905
diff
changeset
|
114 with support.CleanImport("test.test_future5"): |
|
83ae10bf608c
#17303: test_future* now work with unittest test discovery. Patch by Zachary Ware.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
68905
diff
changeset
|
115 from test import test_future5 |
|
49594
30c0b266af06
Merged revisions 67030-67031 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
116 |
|
49624
f3234e43e1fe
Merged revisions 67066 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
49594
diff
changeset
|
117 def test_unicode_literals_exec(self): |
|
f3234e43e1fe
Merged revisions 67066 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
49594
diff
changeset
|
118 scope = {} |
|
f3234e43e1fe
Merged revisions 67066 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
49594
diff
changeset
|
119 exec("from __future__ import unicode_literals; x = ''", {}, scope) |
|
58473
71acd4482e65
Merged revisions 77727 via svnmerge from
Ezio Melotti <ezio.melotti@gmail.com>
parents:
49624
diff
changeset
|
120 self.assertIsInstance(scope["x"], str) |
|
49624
f3234e43e1fe
Merged revisions 67066 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
49594
diff
changeset
|
121 |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
31184
diff
changeset
|
122 |
|
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
|
123 |
|
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
|
124 if __name__ == "__main__": |
|
82409
83ae10bf608c
#17303: test_future* now work with unittest test discovery. Patch by Zachary Ware.
Ezio Melotti <ezio.melotti@gmail.com>
parents:
68905
diff
changeset
|
125 unittest.main() |
