[modules/traffic] compute theme.minwidth based on traffic.format
This commit is contained in:
parent
36c9a24ac4
commit
2f6a2285bd
2 changed files with 39 additions and 1 deletions
23
tests/modules/test_traffic.py
Normal file
23
tests/modules/test_traffic.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import mock
|
||||
import unittest
|
||||
|
||||
import tests.mocks as mocks
|
||||
|
||||
from bumblebee.modules.traffic import Module
|
||||
|
||||
class TestTrafficModule(unittest.TestCase):
|
||||
def setUp(self):
|
||||
mocks.setup_test(self, Module)
|
||||
|
||||
def test_default_format(self):
|
||||
self.assertEqual(self.module._format, "{:.2f}")
|
||||
|
||||
def test_get_minwidth_str(self):
|
||||
# default value (two digits after dot)
|
||||
self.assertEqual(self.module.get_minwidth_str(), "1000.00MB")
|
||||
# integer value
|
||||
self.module._format = "{:.0f}"
|
||||
self.assertEqual(self.module.get_minwidth_str(), "1000MB")
|
||||
# just one digit after dot
|
||||
self.module._format = "{:.1f}"
|
||||
self.assertEqual(self.module.get_minwidth_str(), "1000.0MB")
|
Loading…
Add table
Add a link
Reference in a new issue