From 99665bfce18929dd40bb3fa8d894d7e193a7775f Mon Sep 17 00:00:00 2001 From: Viktor Stanchev Date: Sun, 20 Sep 2015 15:01:57 -0700 Subject: [PATCH] test colored printing more directly --- tests/test_print.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_print.py b/tests/test_print.py index 52b9c5a..32749ff 100755 --- a/tests/test_print.py +++ b/tests/test_print.py @@ -45,6 +45,16 @@ class TestPrint(unittest.TestCase): prettytable.assert_called_once_with(['LINK', 'NAME']) mock.add_row.assert_has_calls([call([0, 'name']), call([1, 'name2'])]) + def test_print_color(self): + printer = Printer(False) + with patch('pirate.print.builtins.print') as mock_print: + printer.print('abc', color='zebra_1') + mock_print.assert_called_once_with('abc') + printer = Printer(True) + with patch('pirate.print.builtins.print') as mock_print: + printer.print('abc', color='zebra_1') + mock_print.assert_called_once_with('\x1b[34mabc', '\x1b[0m') + def test_print_results_local(self): class MockTable: add_row = MagicMock()