def test_format(self): dw = DaemonWatcher(None) self.assertEqual(dw.format_dimless(1, 4), " 1 ") self.assertEqual(dw.format_dimless(1000, 4), "1.0k") self.assertEqual(dw.format_dimless(3.14159, 4), " 3 ") self.assertEqual(dw.format_dimless(1400000, 4), "1.4M")
def test_supports_color(self): dw = DaemonWatcher(None) # Can't count on having a tty available during tests, so only test the false case self.assertEqual(dw.supports_color(StringIO()), False)
def test_col_width(self): dw = DaemonWatcher(None) self.assertEqual(dw.col_width("foo"), 4) self.assertEqual(dw.col_width("foobar"), 6)