Skip to content
Permalink
Browse files

Merge pull request #67 from jkrukoff/master

Allow for greater flexibility in parsing __all__.
  • Loading branch information...
keleshev committed Apr 1, 2014
2 parents a12f427 + 35b1129 commit 1322f2112c1c50055b85d1bf02f410296c0d111b
Showing with 13 additions and 0 deletions.
  1. +2 −0 pep257.py
  2. +11 −0 test_definitions.py
@@ -235,6 +235,8 @@ def parse_all(self):
sys.stderr.write(msg)
self.consume(tk.OP)
s = '('
while self.current.kind in (tk.NL, tk.COMMENT):
self.stream.move()
if self.current.kind != tk.STRING:
raise AllError('Could not evaluate contents of __all__. ')
while self.current.value not in ')]':
@@ -29,6 +29,12 @@ def nested_3(self):
__all__ = ['a', 'b'
'c',]
'''
source_alt_nl_at_bracket = '''
__all__ = [
# Inconvenient comment.
'a', 'b' 'c',]
'''


def test_parser():
@@ -63,6 +69,11 @@ def test_parser():
assert Module('file_alt.py', _, 1, len(source_alt.split('\n')),
None, _, _, all) == module

module = parse(StringIO(source_alt_nl_at_bracket), 'file_alt_nl.py')
assert Module('file_alt_nl.py', _, 1,
len(source_alt_nl_at_bracket.split('\n')), None, _, _,
all) == module


def _test_module():

0 comments on commit 1322f21

Please sign in to comment.
You can’t perform that action at this time.