cfme.utils.units module¶
-
class
cfme.utils.units.Unit(number, prefix, unit_type)[source]¶ Bases:
objectThis class serves for simple comparison of numbers that have units.
Imagine you pull a text value from the UI. 2 GB. By doing
Unit.parse('2 GB')you get an instance ofUnit, which is comparable.You can compare two
Unitinstances or you can compareUnitwithint,floator anystras long as it can go through theUnit.parse().If you compare
Unitonly (or a string that gets subsequently parsed), it also takes the kind of the unit it is, you cannot compare bytes with hertzes. It then calculates the absolute value in the base units and that gets compared.If you compare with a number, it does it like it was the number of the same unit. So eg. doing:
Unit.parse('2 GB') == 2 *1024 * 1024 * 1024 `` is True-
property
absolute¶
-
number¶
-
prefix¶
-
unit_type¶
-
property