|
11 | 11 | # individuals. For the exact contribution history, see the revision |
12 | 12 | # history and logs, available at http://babel.edgewall.org/log/. |
13 | 13 |
|
| 14 | +import __future__ |
14 | 15 | import unittest |
15 | 16 |
|
16 | 17 | import pytest |
|
20 | 21 | from babel.util import parse_future_flags |
21 | 22 |
|
22 | 23 |
|
| 24 | +class _FF: |
| 25 | + division = __future__.division.compiler_flag |
| 26 | + print_function = __future__.print_function.compiler_flag |
| 27 | + with_statement = __future__.with_statement.compiler_flag |
| 28 | + unicode_literals = __future__.unicode_literals.compiler_flag |
| 29 | + |
23 | 30 | def test_distinct(): |
24 | 31 | assert list(util.distinct([1, 2, 1, 3, 4, 4])) == [1, 2, 3, 4] |
25 | 32 | assert list(util.distinct('foobar')) == ['f', 'o', 'b', 'a', 'r'] |
@@ -70,25 +77,25 @@ def test_parse_encoding_non_ascii(): |
70 | 77 | from __future__ import print_function, |
71 | 78 | division, with_statement, |
72 | 79 | unicode_literals |
73 | | -''', 0x10000 | 0x2000 | 0x8000 | 0x20000), |
| 80 | +''', _FF.print_function | _FF.division | _FF.with_statement | _FF.unicode_literals), |
74 | 81 | (''' |
75 | 82 | from __future__ import print_function, division |
76 | 83 | print('hello') |
77 | | -''', 0x10000 | 0x2000), |
| 84 | +''', _FF.print_function | _FF.division), |
78 | 85 | (''' |
79 | 86 | from __future__ import print_function, division, unknown,,,,, |
80 | 87 | print 'hello' |
81 | | -''', 0x10000 | 0x2000), |
| 88 | +''', _FF.print_function | _FF.division), |
82 | 89 | (''' |
83 | 90 | from __future__ import ( |
84 | 91 | print_function, |
85 | 92 | division) |
86 | | -''', 0x10000 | 0x2000), |
| 93 | +''', _FF.print_function | _FF.division), |
87 | 94 | (''' |
88 | 95 | from __future__ import \\ |
89 | 96 | print_function, \\ |
90 | 97 | division |
91 | | -''', 0x10000 | 0x2000), |
| 98 | +''', _FF.print_function | _FF.division), |
92 | 99 | ]) |
93 | 100 | def test_parse_future(source, result): |
94 | 101 | fp = BytesIO(source.encode('latin-1')) |
|
0 commit comments