MCPcopy Create free account
hub / github.com/apify/crawlee-python / test_subtractions

Function test_subtractions

tests/unit/_utils/test_byte_size.py:62–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60
61
62def test_subtractions() -> None:
63 # Direct subtraction of ByteSize instances
64 size1 = ByteSize(2048)
65 size2 = ByteSize(1024)
66 assert (size1 - size2).bytes == 1024
67
68 # Subtraction resulting in a negative value raises ValueError
69 with pytest.raises(ValueError, match=r'Resulting ByteSize cannot be negative'):
70 _ = size2 - size1
71
72 # Subtraction of ByteSize instance and an int
73 with pytest.raises(TypeError):
74 _ = size1 - 1024
75
76 # Subtraction of ByteSize instance and an float
77 with pytest.raises(TypeError):
78 _ = size2 - 123.45
79
80
81def test_multiplication() -> None:

Callers

nothing calls this directly

Calls 1

ByteSizeClass · 0.90

Tested by

no test coverage detected