import gzip from io import BytesIO from pathlib import Path import pytest from utils import aws_utils @pytest.mark.parametrize( 'inp, expected', [ ('1', ['1']), ('12', ['12']), ('123', ['1', '23']), ('1234', ['1', '2', '34']), ]) def test_stick_last_two(inp, expected): result = list(aws_utils.stick_last_two(inp)) assert result == expected @pytest.mark.parametrize( 'inp, expected', [ (100, '100.0 B'), (1024**2*4, '4.0 MB'), (1000000000, '953.7 MB'), (1000000000000, '931.3 GB'), (1024**6, '1024.0 PB'), (1024**7.1, '2097152.0 PB'), ]) def test_human_readable_size(inp, expected): result = aws_utils.human_readable_size(inp, decimal_places=1) assert result == expected