Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
grumpy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
grumpy
Commits
d819a441
Commit
d819a441
authored
Apr 07, 2017
by
Dylan Trotter
Committed by
GitHub
Apr 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement future unicode_literals. (#286)
parent
6ec81e81
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
compiler/imputil.py
compiler/imputil.py
+5
-1
compiler/imputil_test.py
compiler/imputil_test.py
+0
-2
compiler/stmt_test.py
compiler/stmt_test.py
+6
-0
No files found.
compiler/imputil.py
View file @
d819a441
...
...
@@ -180,7 +180,11 @@ _FUTURE_FEATURES = (
'unicode_literals'
,
)
_IMPLEMENTED_FUTURE_FEATURES
=
(
'absolute_import'
,
'print_function'
,)
_IMPLEMENTED_FUTURE_FEATURES
=
(
'absolute_import'
,
'print_function'
,
'unicode_literals'
)
# These future features are already in the language proper as of 2.6, so
# importing them via __future__ has no effect.
...
...
compiler/imputil_test.py
View file @
d819a441
...
...
@@ -279,8 +279,6 @@ class MakeFutureFeaturesTest(unittest.TestCase):
# by grumpy
(
'from __future__ import division'
,
r'future feature \
w+
not yet implemented'
),
(
'from __future__ import unicode_literals'
,
r'future feature \
w+
not yet implemented'
),
(
'from __future__ import braces'
,
'not a chance'
),
(
'from __future__ import nonexistant_feature'
,
r'future feature \
w+ is
not defined'
),
...
...
compiler/stmt_test.py
View file @
d819a441
...
...
@@ -303,6 +303,12 @@ class StatementVisitorTest(unittest.TestCase):
self
.
assertRaisesRegexp
(
util
.
ImportError
,
regexp
,
_ParseAndVisit
,
'foo = bar
\
n
from __future__ import print_function'
)
def
testFutureUnicodeLiterals
(
self
):
want
=
"u'foo'
\
n
"
self
.
assertEqual
((
0
,
want
),
_GrumpRun
(
textwrap
.
dedent
(
"""
\
from __future__ import unicode_literals
print repr('foo')"""
)))
def
testImportMember
(
self
):
self
.
assertEqual
((
0
,
"<type 'dict'>
\
n
"
),
_GrumpRun
(
textwrap
.
dedent
(
"""
\
from sys import modules
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment