Skip to content

Commit

Permalink
test edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNicholas committed Aug 1, 2023
1 parent fc8ee07 commit 0a71bfa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cubed/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,17 @@ def test_max_mem_deprecation_warning(self):
[
(500, 500),
(100_000, 100_000),
(50.0, 50),
("500B", 500),
("1kB", 1000),
("1MB", 1000**2),
("1GB", 1000**3),
("1TB", 1000**4),
("1PB", 1000**5),
("100_000", 100_000),
("1.2MB", 1.2 * 1000**2),
("1 MB", 1000**2),
("1.2 MB", 1.2 * 1000**2),
],
)
def test_convert_to_bytes(self, input_value, expected_value):
Expand All @@ -302,7 +307,8 @@ def test_convert_to_bytes(self, input_value, expected_value):
"1kb", # lower-case k is not valid
"invalid", # completely invalid input
-512, # negative integer
1000.0, # invalid type
"kB", # only unit, no value
"1.1B", # can't have a fractional number of bytes
],
)
def test_convert_to_bytes_error(self, input_value):
Expand Down

0 comments on commit 0a71bfa

Please sign in to comment.