Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit febdafa

Browse files
committed
Moved unicode_literals test to test case / parser tests.
1 parent d9d5f77 commit febdafa

File tree

3 files changed

+18
-29
lines changed

3 files changed

+18
-29
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -*- coding: utf-8 -*-
2+
"""This is a module."""
3+
4+
from __future__ import unicode_literals
5+
6+
7+
def with_unicode_docstring_without_u():
8+
"""Check unicode: \u2611."""

src/tests/test_definitions.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ def nested_3(self):
3939
source_unicode_literals = '''
4040
from __future__ import unicode_literals
4141
'''
42+
source_multiple_future_imports = '''
43+
from __future__ import (nested_scopes as ns,
44+
unicode_literals)
45+
'''
4246

4347

4448
def test_parser():
@@ -86,6 +90,12 @@ def test_parser():
8690
assert Module('file_ucl.py', _, 1,
8791
_, _, None, _, _,
8892
_, {'unicode_literals': True}) == module
93+
94+
module = parse(StringIO(source_multiple_future_imports), 'file_mfi.py')
95+
assert Module('file_mfi.py', _, 1,
96+
_, _, None, _, _,
97+
_, {'unicode_literals': True, 'nested_scopes': True}) \
98+
== module
8999
assert module.future_imports['unicode_literals']
90100

91101

src/tests/test_pep257.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -315,35 +315,6 @@ def test_unicode_literals():
315315
def u(x):
316316
return unicode_escape_decode(x)[0]
317317

318-
# Check that D302 is reported with unicode docstring
319-
with Pep257Env() as env:
320-
with env.open('example.py', 'wt') as example:
321-
example.write(textwrap.dedent(u('''\
322-
# -*- coding: utf-8 -*-
323-
"""This is a module."""
324-
325-
def foo():
326-
"""Check unicode: \u2611."""
327-
''').encode('utf-8')))
328-
_, err, code = env.invoke_pep257()
329-
assert code == 1
330-
assert 'D302' in err
331-
332-
# Check that D302 is not reported when import unicode_literals
333-
with Pep257Env() as env:
334-
with env.open('example.py', 'wt') as example:
335-
example.write(textwrap.dedent(u('''\
336-
# -*- coding: utf-8 -*-
337-
"""This is a module."""
338-
339-
from __future__ import unicode_literals
340-
341-
def foo():
342-
"""Check unicode: \u2611."""
343-
''').encode('utf-8')))
344-
_, err, code = env.invoke_pep257()
345-
assert code == 0, err
346-
347318
with Pep257Env() as env:
348319
with env.open('example.py', 'wt') as example:
349320
example.write(textwrap.dedent(u('''\

0 commit comments

Comments
 (0)