Add unit tests
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
from bmspy.utilities import debugger
|
||||
|
||||
|
||||
class TestDebugger:
|
||||
def test_prints_message(self, capsys):
|
||||
debugger("hello world")
|
||||
captured = capsys.readouterr()
|
||||
assert "hello world" in captured.out
|
||||
|
||||
def test_includes_timestamp(self, capsys):
|
||||
debugger("test")
|
||||
captured = capsys.readouterr()
|
||||
# timestamp is prepended
|
||||
assert "test" in captured.out
|
||||
assert len(captured.out.strip()) > len("test")
|
||||
|
||||
def test_pretty_true(self, capsys):
|
||||
debugger({"key": "value"}, pretty=True)
|
||||
captured = capsys.readouterr()
|
||||
# pretty-printed output includes the data key
|
||||
assert "key" in captured.out
|
||||
|
||||
def test_pretty_false_no_pprint(self, capsys):
|
||||
debugger("simple message", pretty=False)
|
||||
captured = capsys.readouterr()
|
||||
assert "simple message" in captured.out
|
||||
Reference in New Issue
Block a user