-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Bryce Gattis <[email protected]>
- Loading branch information
1 parent
0716cd8
commit a24403c
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright Contributors to the Rez Project | ||
|
||
|
||
""" | ||
unit tests for 'utils.formatting' module | ||
""" | ||
from rez.tests.util import TestBase | ||
from rez.utils import formatting | ||
|
||
|
||
class TestFormatting(TestBase): | ||
def test_readable_units(self): | ||
readable_units = formatting._readable_units( | ||
0, | ||
formatting.memory_divs | ||
) | ||
self.assertEqual(readable_units, "0 bytes") | ||
|
||
readable_units = formatting._readable_units( | ||
1024, | ||
formatting.memory_divs | ||
) | ||
self.assertEqual(readable_units, "1 Kb") | ||
|
||
readable_units = formatting._readable_units( | ||
1200, | ||
formatting.memory_divs | ||
) | ||
self.assertEqual(readable_units, "1.2 Kb") | ||
|
||
readable_units = formatting._readable_units( | ||
-30000, | ||
formatting.memory_divs | ||
) | ||
self.assertEqual(readable_units, "-29 Kb") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters