diff options
Diffstat (limited to 'ttystatus/progressbar_tests.py')
-rw-r--r-- | ttystatus/progressbar_tests.py | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/ttystatus/progressbar_tests.py b/ttystatus/progressbar_tests.py index 0e3bf5a..a5dd425 100644 --- a/ttystatus/progressbar_tests.py +++ b/ttystatus/progressbar_tests.py @@ -23,39 +23,43 @@ class ProgressBarTests(unittest.TestCase): def setUp(self): self.w = ttystatus.ProgressBar('done', 'total') + self.width = 10 + + def test_is_not_static_width(self): + self.assertFalse(self.w.static_width) def test_sets_initial_value_to_empty(self): - self.assertEqual(str(self.w), '') + self.assertEqual(self.w.render(self.width), '-' * 10) def test_shows_zero_percent_for_empty_string_total(self): - self.w.update({ 'done': 1, 'total': '' }, 10) - self.assertEqual(str(self.w), '-' * 10) + self.w.update({ 'done': 1, 'total': '' }) + self.assertEqual(self.w.render(self.width), '-' * 10) def test_shows_zero_percent_for_zero_total(self): - self.w.update({ 'done': 1, 'total': 0 }, 10) - self.assertEqual(str(self.w), '-' * 10) + self.w.update({ 'done': 1, 'total': 0 }) + self.assertEqual(self.w.render(self.width), '-' * 10) def test_shows_zero_percent_correctly(self): - self.w.update({ 'done': 0, 'total': 100 }, 10) - self.assertEqual(str(self.w), '-' * 10) + self.w.update({ 'done': 0, 'total': 100 }) + self.assertEqual(self.w.render(self.width), '-' * 10) def test_shows_one_percent_correctly(self): - self.w.update({ 'done': 1, 'total': 100 }, 10) - self.assertEqual(str(self.w), '-' * 10) + self.w.update({ 'done': 1, 'total': 100 }) + self.assertEqual(self.w.render(self.width), '-' * 10) def test_shows_ten_percent_correctly(self): - self.w.update({ 'done': 10, 'total': 100 }, 10) - self.assertEqual(str(self.w), '#' + '-' * 9) + self.w.update({ 'done': 10, 'total': 100 }) + self.assertEqual(self.w.render(self.width), '#' + '-' * 9) def test_shows_ninety_percent_correctly(self): - self.w.update({ 'done': 90, 'total': 100 }, 10) - self.assertEqual(str(self.w), '#' * 9 + '-') + self.w.update({ 'done': 90, 'total': 100 }) + self.assertEqual(self.w.render(self.width), '#' * 9 + '-') def test_shows_ninety_ine_percent_correctly(self): - self.w.update({ 'done': 99, 'total': 100 }, 10) - self.assertEqual(str(self.w), '#' * 10) + self.w.update({ 'done': 99, 'total': 100 }) + self.assertEqual(self.w.render(self.width), '#' * 10) def test_shows_one_hundred_percent_correctly(self): - self.w.update({ 'done': 100, 'total': 100 }, 10) - self.assertEqual(str(self.w), '#' * 10) + self.w.update({ 'done': 100, 'total': 100 }) + self.assertEqual(self.w.render(self.width), '#' * 10) |