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

Commit 10b3bba

Browse files
committed
Merge pull request #74 from Nurdok/fix-tests
Fix tests
2 parents 1322f21 + e5912e9 commit 10b3bba

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

test.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,4 @@ def old_209():
216216
217217
"""
218218

219-
220-
def run():
221-
"""Run the functions above and check errors agains expected errors."""
222-
import pep257
223-
expect(__file__, 'D100: Docstring missing')
224-
results = list(pep257.check([__file__]))
225-
assert set(map(type, results)) == set([pep257.Error]), results
226-
results = set([(e.definition.name, e.message) for e in results])
227-
print('\n extra: %r' % (results - expected))
228-
print('\nmissing: %r' % (expected - results))
229-
assert expected == results
219+
expect('test.py', 'D100: Docstring missing')

test_definitions.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pep257 import (StringIO, TokenStream, Parser,
1+
from pep257 import (StringIO, TokenStream, Parser, Error, check,
22
Module, Class, Method, Function, NestedFunction)
33

44

@@ -91,10 +91,6 @@ def _test_module():
9191
assert function.name == 'function'
9292
assert function.docstring == '"""Function docstring."""'
9393

94-
#nested_function, = function.children
95-
#assert nested_function.source.startswith('def nested_function')
96-
#assert nested_function.source.endswith('pass\n')
97-
9894

9995
def test_token_stream():
10096
stream = TokenStream(StringIO('hello#world'))
@@ -108,4 +104,9 @@ def test_token_stream():
108104
def test_pep257():
109105
"""Run domain-specific tests from test.py file."""
110106
import test
111-
test.run()
107+
results = list(check(['test.py']))
108+
assert set(map(type, results)) == set([Error]), results
109+
results = set([(e.definition.name, e.message) for e in results])
110+
print('\nextra: %r' % (results - test.expected))
111+
print('\nmissing: %r' % (test.expected - results))
112+
assert test.expected == results

0 commit comments

Comments
 (0)