Skip to content

Commit

Permalink
move tests under tests/
Browse files Browse the repository at this point in the history
  • Loading branch information
JakkuSakura committed Sep 26, 2024
1 parent ab8537c commit f4299e1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 29 deletions.
29 changes: 0 additions & 29 deletions pyinfra/facts/util/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,3 @@ def parse_size(size: str | int) -> int:
if isinstance(size, int):
return size
return parse_human_readable_size(size)


def test_parse_human_readable_size():
example_strings = [
"1024b",
"10.43 KB",
"11 GB",
"343.1 MB",
"10.43KB",
"11GB",
"343.1MB",
"10.43 kb",
"11 gb",
"343.1 mb",
"10.43kb",
"11gb",
"343.1mb",
"1024Kib",
"10.43 KiB",
"11 GiB",
"343.1 MiB",
"10.43KiB",
"11GiB",
"343.1MiB",
"10.43 kib",
"11 gib",
]
for example_string in example_strings:
print(example_string, parse_human_readable_size(example_string))
30 changes: 30 additions & 0 deletions tests/test_units.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from pyinfra.facts.util.units import parse_human_readable_size


def test_parse_human_readable_size():
example_strings = [
"1024b",
"10.43 KB",
"11 GB",
"343.1 MB",
"10.43KB",
"11GB",
"343.1MB",
"10.43 kb",
"11 gb",
"343.1 mb",
"10.43kb",
"11gb",
"343.1mb",
"1024Kib",
"10.43 KiB",
"11 GiB",
"343.1 MiB",
"10.43KiB",
"11GiB",
"343.1MiB",
"10.43 kib",
"11 gib",
]
for example_string in example_strings:
print(example_string, parse_human_readable_size(example_string))

0 comments on commit f4299e1

Please sign in to comment.