Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JBKahn committed Nov 4, 2014
1 parent 1ac7cb7 commit 65af2c7
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flake8_debugger import check_code_for_debugger_statements, format_debugger_message, DEBUGGER_ERROR_CODE
from flake8_debugger import check_code_for_debugger_statements, format_debugger_message
from nose.tools import assert_equal


Expand All @@ -20,6 +20,16 @@ def test_import(self):
result = check_code_for_debugger_statements('import pdb')
assert_equal(result, [self.generate_error_statement(1, 0, 'import', 'pdb', 'pdb')])

def test_import_both_same_line(self):
result = check_code_for_debugger_statements('import pdb, ipdb')
assert_equal(
result,
[
self.generate_error_statement(1, 0, 'import', 'ipdb', 'ipdb'),
self.generate_error_statement(1, 0, 'import', 'pdb', 'pdb'),
]
)

def test_import_math(self):
result = check_code_for_debugger_statements('import math')
assert_equal(result, [])
Expand Down Expand Up @@ -50,6 +60,17 @@ def test_import_pdb_use_set_trace(self):
]
)

def test_import_pdb_use_set_trace_twice(self):
result = check_code_for_debugger_statements('import pdb;pdb.set_trace() and pdb.set_trace();')
assert_equal(
result,
[
self.generate_error_statement(1, 0, 'import', 'pdb', 'pdb'),
self.generate_error_statement(1, 11, 'set_trace', 'pdb', 'set_trace'),
self.generate_error_statement(1, 31, 'set_trace', 'pdb', 'set_trace')
]
)


class TestImportAsCases(Flake8DebuggerTestCases):
def test_import_ipdb_as(self):
Expand Down

0 comments on commit 65af2c7

Please sign in to comment.