def test_memory_is_bytes_no_conversion_needed(self): value = 40 mem = Memory(value) actual = mem.bytes() expected = value assert actual == expected
def test_memory_is_kilobytes_nondecimal_returns_power_of_two(self): value = 40 unit = Unit.KILO mem = Memory(value, unit) actual = mem.bytes(decimal_multiples=False) expected = 40_960 assert actual == expected
def test_memory_is_megabytes_conversion_needed(self): value = 40 unit = Unit.MEGA mem = Memory(value, unit) actual = mem.bytes() expected = 40_000_000 assert actual == expected
def test_large_floats_comparison(self): value = 500 unit = Unit.ZETTA mem = Memory(value, unit) actual = mem.bytes() expected = float(500_000_000_000_000_000_000_000) assert actual == expected
def test_float_as_value(self): value = 0.5 unit = Unit.GIGA mem = Memory(value, unit) actual = mem.bytes() expected = 500_000_000 assert actual == expected