Reformat asserts
This commit is contained in:
parent
fcdd25c974
commit
2ee246d133
10 changed files with 77 additions and 77 deletions
|
|
@ -5,22 +5,22 @@ from src.great_ai.large_file.helper import human_readable_to_byte
|
|||
|
||||
class TestHumanReadableToByte(unittest.TestCase):
|
||||
def test_simple_cases(self) -> None:
|
||||
self.assertEqual(human_readable_to_byte("1KB"), 1024)
|
||||
self.assertEqual(human_readable_to_byte("2KB"), 2048)
|
||||
assert human_readable_to_byte("1KB") == 1024
|
||||
assert human_readable_to_byte("2KB") == 2048
|
||||
|
||||
def test_fractions(self) -> None:
|
||||
self.assertEqual(human_readable_to_byte("0.5KB"), 512)
|
||||
self.assertEqual(human_readable_to_byte("20.5KB"), 1024 * 20 + 512)
|
||||
assert human_readable_to_byte("0.5KB") == 512
|
||||
assert human_readable_to_byte("20.5KB") == 1024 * 20 + 512
|
||||
|
||||
def test_formating(self) -> None:
|
||||
self.assertEqual(human_readable_to_byte(" 1MB"), 1024 * 1024)
|
||||
self.assertEqual(human_readable_to_byte(" 2 MB"), 1024 * 1024 * 2)
|
||||
self.assertEqual(human_readable_to_byte(" 4 MB "), 1024 * 1024 * 4)
|
||||
self.assertEqual(human_readable_to_byte("8MB "), 1024 * 1024 * 8)
|
||||
self.assertEqual(human_readable_to_byte(" 1.5 MB "), 1024 * 1024 * 1.5)
|
||||
assert human_readable_to_byte(" 1MB") == 1024 * 1024
|
||||
assert human_readable_to_byte(" 2 MB") == 1024 * 1024 * 2
|
||||
assert human_readable_to_byte(" 4 MB ") == 1024 * 1024 * 4
|
||||
assert human_readable_to_byte("8MB ") == 1024 * 1024 * 8
|
||||
assert human_readable_to_byte(" 1.5 MB ") == 1024 * 1024 * 1.5
|
||||
|
||||
def test_casing(self) -> None:
|
||||
self.assertEqual(human_readable_to_byte("0.5GB"), 0.5 * 1024 * 1024 * 1024)
|
||||
self.assertEqual(human_readable_to_byte("0.5gB"), 0.5 * 1024 * 1024 * 1024)
|
||||
self.assertEqual(human_readable_to_byte("0.5Gb"), 0.5 * 1024 * 1024 * 1024)
|
||||
self.assertEqual(human_readable_to_byte("0.5gb"), 0.5 * 1024 * 1024 * 1024)
|
||||
assert human_readable_to_byte("0.5GB") == 0.5 * 1024 * 1024 * 1024
|
||||
assert human_readable_to_byte("0.5gB") == 0.5 * 1024 * 1024 * 1024
|
||||
assert human_readable_to_byte("0.5Gb") == 0.5 * 1024 * 1024 * 1024
|
||||
assert human_readable_to_byte("0.5gb") == 0.5 * 1024 * 1024 * 1024
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ class TestLargeFileS3(unittest.TestCase):
|
|||
Bucket=credentials["large_files_bucket_name"], Prefix="test-file"
|
||||
)
|
||||
|
||||
self.assertEqual(lf._version, 2)
|
||||
self.assertEqual(lf._local_name, "test-file-2")
|
||||
assert lf._version == 2
|
||||
assert lf._local_name == "test-file-2"
|
||||
|
||||
@patch.object(boto3, "client")
|
||||
def test_initialized_with_file(self, client: Any) -> None:
|
||||
|
|
@ -116,5 +116,5 @@ class TestLargeFileS3(unittest.TestCase):
|
|||
Bucket=credentials["large_files_bucket_name"], Prefix="test-file"
|
||||
)
|
||||
|
||||
self.assertEqual(lf._version, 2)
|
||||
self.assertEqual(lf._local_name, "test-file-2")
|
||||
assert lf._version == 2
|
||||
assert lf._local_name == "test-file-2"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue