()
| 6 | |
| 7 | |
| 8 | def test_initializations() -> None: |
| 9 | assert ByteSize(1024).bytes == 1024 |
| 10 | assert ByteSize.from_kb(1).bytes == 1024 |
| 11 | assert ByteSize.from_mb(1).bytes == 1024**2 |
| 12 | assert ByteSize.from_gb(1).bytes == 1024**3 |
| 13 | assert ByteSize.from_tb(1).bytes == 1024**4 |
| 14 | |
| 15 | with pytest.raises(ValueError, match=r'ByteSize cannot be negative'): |
| 16 | ByteSize(-1) |
| 17 | |
| 18 | |
| 19 | def test_conversions() -> None: |