コード例 #1
0
    def test_terabytes_to_kilobytes_in_binary(self):
        memory = Memory(30, Unit.TERA)
        desired_units = Unit.KILO

        actual = memory.to(desired_units, decimal_multiples=False)
        expected = Memory(32_212_254_720, desired_units)

        assert actual == expected
コード例 #2
0
    def test_bytes_to_kilobytes(self):
        memory = Memory(10)
        desired_units = Unit.KILO

        actual = memory.to(desired_units)
        expected = Memory(0.01, desired_units)

        assert actual == expected
コード例 #3
0
    def test_terabytes_to_megabytes(self):
        memory = Memory(30, Unit.TERA)
        desired_units = Unit.MEGA

        actual = memory.to(desired_units)
        expected = Memory(30_000_000, desired_units)

        assert actual == expected
コード例 #4
0
    def test_bytes_to_bytes(self):
        memory = Memory(10)
        desired_units = Unit.BYTES

        actual = memory.to(desired_units)
        expected = Memory(10, desired_units)

        assert actual == expected