diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2014-09-26 21:12:30 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2014-09-26 21:12:30 -0400 |
commit | 0cf4172b2791f886147b9778a3ea8d20bc00b3b6 (patch) | |
tree | 42b980c1331965ba8a4b0ccc92306a6f87d8983d /tests/test_cmdline.py | |
parent | fd1ae23848b18ea9f991fc1b669a5a82aed637aa (diff) | |
download | python-coveragepy-0cf4172b2791f886147b9778a3ea8d20bc00b3b6.tar.gz |
Make these proper unittest asserts
Diffstat (limited to 'tests/test_cmdline.py')
-rw-r--r-- | tests/test_cmdline.py | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index a2fec39..bf99bf8 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -8,7 +8,6 @@ from coverage.misc import ExceptionDuringRun from tests.coveragetest import CoverageTest, OK, ERR -# TODO: change bare asserts to unittest asserts. # TODO: base these tests on new cmdline, not old. class CmdLineTest(CoverageTest): @@ -476,8 +475,8 @@ class NewCmdLineTest(CmdLineTest): def test_debug_sys(self): self.command_line("debug sys") out = self.stdout() - assert "version:" in out - assert "data_path:" in out + self.assertIn("version:", out) + self.assertIn("data_path:", out) def test_erase(self): self.cmd_executes_same("erase", "-e") @@ -690,33 +689,33 @@ class CmdLineStdoutTest(CmdLineTest): def test_minimum_help(self): self.command_line("") out = self.stdout() - assert "Code coverage for Python." in out - assert out.count("\n") < 4 + self.assertIn("Code coverage for Python.", out) + self.assertLess(out.count("\n"), 4) def test_version(self): self.command_line("--version") out = self.stdout() - assert "ersion " in out - assert out.count("\n") < 4 + self.assertIn("ersion ", out) + self.assertLess(out.count("\n"), 4) def test_help(self): self.command_line("help") out = self.stdout() - assert "nedbatchelder.com" in out - assert out.count("\n") > 10 + self.assertIn("nedbatchelder.com", out) + self.assertGreater(out.count("\n"), 10) def test_cmd_help(self): self.command_line("help run") out = self.stdout() - assert "<pyfile>" in out - assert "--timid" in out - assert out.count("\n") > 10 + self.assertIn("<pyfile>", out) + self.assertIn("--timid", out) + self.assertGreater(out.count("\n"), 10) def test_error(self): self.command_line("fooey kablooey", ret=ERR) out = self.stdout() - assert "fooey" in out - assert "help" in out + self.assertIn("fooey", out) + self.assertIn("help", out) class CmdMainTest(CoverageTest): |