Best Python code snippet using localstack_python
misc.py
Source:misc.py
2from chia.util.misc import format_bytes3from chia.util.misc import format_minutes4class TestMisc:5 @pytest.mark.asyncio6 async def test_format_bytes(self):7 assert format_bytes(None) == "Invalid"8 assert format_bytes(dict()) == "Invalid"9 assert format_bytes("some bytes") == "Invalid"10 assert format_bytes(-1024) == "Invalid"11 assert format_bytes(0) == "0.000 MiB"12 assert format_bytes(1024) == "0.001 MiB"13 assert format_bytes(1024 ** 2 - 1000) == "0.999 MiB"14 assert format_bytes(1024 ** 2) == "1.000 MiB"15 assert format_bytes(1024 ** 3) == "1.000 GiB"16 assert format_bytes(1024 ** 4) == "1.000 TiB"17 assert format_bytes(1024 ** 5) == "1.000 PiB"18 assert format_bytes(1024 ** 6) == "1.000 EiB"19 assert format_bytes(1024 ** 7) == "1.000 ZiB"20 assert format_bytes(1024 ** 8) == "1.000 YiB"21 assert format_bytes(1024 ** 9) == "1024.000 YiB"22 assert format_bytes(1024 ** 10) == "1048576.000 YiB"23 assert format_bytes(1024 ** 20).endswith("YiB")24 @pytest.mark.asyncio25 async def test_format_minutes(self):26 assert format_minutes(None) == "Invalid"27 assert format_minutes(dict()) == "Invalid"28 assert format_minutes("some minutes") == "Invalid"29 assert format_minutes(-1) == "Unknown"30 assert format_minutes(0) == "Now"31 assert format_minutes(1) == "1 minute"32 assert format_minutes(59) == "59 minutes"33 assert format_minutes(60) == "1 hour"34 assert format_minutes(61) == "1 hour and 1 minute"35 assert format_minutes(119) == "1 hour and 59 minutes"36 assert format_minutes(1380) == "23 hours"37 assert format_minutes(1440) == "1 day"...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!