Skip to content

Commit

Permalink
Run doctests in unittests...
Browse files Browse the repository at this point in the history
...and fix one wrong doctest
  • Loading branch information
Jens Diemer committed Feb 27, 2024
1 parent 9e702ab commit 8f3f6bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions huey_monitor/humanize.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def percentage(num, total) -> str | None:
'25%'
>>> percentage(33.333, 100)
'33%'
>>> percentage(123, 0)
None
>>> percentage(123, 0) is None
True
"""
if not total:
return None
Expand Down
17 changes: 17 additions & 0 deletions huey_monitor_project/tests/test_doctest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from bx_py_utils.test_utils.unittest_utils import BaseDocTests, DocTestResults

import huey_monitor
import huey_monitor_project


class DocTests(BaseDocTests):
def test_doctests(self):
results: DocTestResults = self.run_doctests(
modules=(
huey_monitor,
huey_monitor_project,
)
)
self.assertGreaterEqual(results.passed, 25)
self.assertEqual(results.skipped, 0)
self.assertLessEqual(results.failed, 0)

0 comments on commit 8f3f6bc

Please sign in to comment.