Skip to content

Instantly share code, notes, and snippets.

@mhrivnak
Created February 15, 2013 16:36
Show Gist options
  • Save mhrivnak/4961569 to your computer and use it in GitHub Desktop.
Save mhrivnak/4961569 to your computer and use it in GitHub Desktop.
def bar1():
for x in range(4):
if x == 0:
pass
else:
# coverage thinks this line isn't covered
continue
def bar2():
for x in range(4):
if x == 0:
pass
else:
# any statement here in addition to the "continue" seems to cause
# coverage to be satisfied for the entire "else" block
True
continue
import unittest
import foo
class TestBar(unittest.TestCase):
def test_bar(self):
foo.bar1()
foo.bar2()
@mhrivnak
Copy link
Author

$ nosetests --with-coverage
.
Name    Stmts   Miss  Cover   Missing
-------------------------------------
foo        13      1    92%   7
----------------------------------------------------------------------
Ran 1 test in 0.008s

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment