-
- Downloads
Normalize label input arguments
Functions like size_label() and time_label() are documented as taking an int argument, but getting a float shouldn't make them choke. Especially in such an unhelpful way... ====================================================================== ERROR: test_time_label Checks the time_label() function. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/atagar/Desktop/stem/test/unit/util/str_tools.py", line 99, in test_time_label self.assertEqual('0s', str_tools.time_label(0.1)) File "/home/atagar/Desktop/stem/stem/util/str_tools.py", line 366, in time_label return _get_label(TIME_UNITS, seconds, decimal, is_long) File "/home/atagar/Desktop/stem/stem/util/str_tools.py", line 595, in _get_label raise ValueError('BUG: %s should always be divisible by a unit (%s)' % (count, str(units))) ValueError: BUG: 0.1 should always be divisible by a unit (((86400.0, 'd', ' day'), (3600.0, 'h', ' hour'), (60.0, 'm', ' minute'), (1.0, 's', ' second')))