| 60 | |
| 61 | |
| 62 | def 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 | |
| 81 | def test_multiplication() -> None: |