mirror of
https://github.com/powerline/powerline.git
synced 2025-07-23 22:05:43 +02:00
Update tests
This commit is contained in:
parent
cde7669251
commit
2d9110b5f1
@ -176,8 +176,15 @@ class TestCommon(TestCase):
|
|||||||
|
|
||||||
def test_uptime(self):
|
def test_uptime(self):
|
||||||
pl = Pl()
|
pl = Pl()
|
||||||
|
with replace_attr(common, '_get_uptime', lambda: 259200):
|
||||||
|
self.assertEqual(common.uptime(pl=pl), [{'contents': '3d', 'divider_highlight_group': 'background:divider'}])
|
||||||
|
with replace_attr(common, '_get_uptime', lambda: 93784):
|
||||||
|
self.assertEqual(common.uptime(pl=pl), [{'contents': '1d 2h 3m', 'divider_highlight_group': 'background:divider'}])
|
||||||
|
self.assertEqual(common.uptime(pl=pl, shorten_len=4), [{'contents': '1d 2h 3m 4s', 'divider_highlight_group': 'background:divider'}])
|
||||||
with replace_attr(common, '_get_uptime', lambda: 65536):
|
with replace_attr(common, '_get_uptime', lambda: 65536):
|
||||||
self.assertEqual(common.uptime(pl=pl), [{'contents': '0d 18h 12m', 'divider_highlight_group': 'background:divider'}])
|
self.assertEqual(common.uptime(pl=pl), [{'contents': '18h 12m 16s', 'divider_highlight_group': 'background:divider'}])
|
||||||
|
self.assertEqual(common.uptime(pl=pl, shorten_len=2), [{'contents': '18h 12m', 'divider_highlight_group': 'background:divider'}])
|
||||||
|
self.assertEqual(common.uptime(pl=pl, shorten_len=1), [{'contents': '18h', 'divider_highlight_group': 'background:divider'}])
|
||||||
|
|
||||||
def _get_uptime():
|
def _get_uptime():
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
Loading…
x
Reference in New Issue
Block a user