forked from jendrikseipp/vulture
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Increase test coverage (jendrikseipp#126)
* Ensure sort_by_size is actually tested. * Test Item.__repr__
- Loading branch information
1 parent
e0e384e
commit 01a5031
Showing
4 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from . import v | ||
assert v # Silence pyflakes | ||
|
||
|
||
def test_item_repr(v): | ||
v.scan("""\ | ||
import os | ||
message = "foobar" | ||
class Foo: | ||
def bar(): | ||
pass | ||
""") | ||
for item in v.get_unused_code(): | ||
assert repr(item) == "'{}'".format(item.name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from . import v | ||
assert v # Silence pyflakes | ||
|
||
|
||
def test_sorting(v): | ||
v.scan("""\ | ||
def foo(): | ||
print("Hello, I am a long function.") | ||
return "World" | ||
def bar(): | ||
pass | ||
""") | ||
assert [item.name for item in | ||
v.get_unused_code(sort_by_size=True)] == ['bar', 'foo'] | ||
assert [item.name for item in | ||
v.get_unused_code(sort_by_size=False)] == ['foo', 'bar'] |