-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[QOLSVC-3826] Convert empty size string to None and add unit tests
- Loading branch information
1 parent
eb8b44a
commit 2c5d92a
Showing
2 changed files
with
26 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
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,23 @@ | ||
# encoding: utf-8 | ||
"""Unit tests for ckan/logic/converters.py. | ||
""" | ||
import six | ||
from ckanext.data_qld.converters import filesize_converter | ||
|
||
|
||
def test_filesize_converter(): | ||
test_cases = {'foo': 'FOO', | ||
'FOO': 'FOO', | ||
'foo,baz': 'FOOBAZ', | ||
' , ': None, | ||
' ': None, | ||
'': None, | ||
None: None, | ||
1024: '1 KiB', | ||
'1024': '1 KiB', | ||
'1024, ': '1 KiB', | ||
'1024a': '1024A', | ||
} | ||
for key, value in six.iteritems(test_cases): | ||
assert value == filesize_converter(key, {}) |