-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from kellyjonbrazil/dev
Dev v1.5.5
- Loading branch information
Showing
6 changed files
with
113 additions
and
8 deletions.
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
"""jello - query JSON at the command line with python syntax""" | ||
|
||
|
||
__version__ = '1.5.4' | ||
__version__ = '1.5.5' | ||
AUTHOR = 'Kelly Brazil' | ||
WEBSITE = 'https://github.com/kellyjonbrazil/jello' | ||
COPYRIGHT = '© 2020-2022 Kelly Brazil' | ||
COPYRIGHT = '© 2020-2023 Kelly Brazil' | ||
LICENSE = 'MIT License' |
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
setuptools.setup( | ||
name='jello', | ||
version='1.5.4', | ||
version='1.5.5', | ||
author='Kelly Brazil', | ||
author_email='[email protected]', | ||
description='Filter JSON and JSON Lines data with Python syntax.', | ||
|
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,62 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import unittest | ||
from jello.lib import load_json | ||
|
||
|
||
class MyTests(unittest.TestCase): | ||
pretty_json = '''\ | ||
{ | ||
"foo": 1, | ||
"bar": 2, | ||
"baz": 3 | ||
}''' | ||
|
||
compact_json = '''{"foo": 1,"bar": 2,"baz": 3}''' | ||
|
||
json_lines = '''\ | ||
{"foo": 1,"bar": 2,"baz": 3} | ||
{"foo": 4,"bar": 5,"baz": 6} | ||
{"foo": 7,"bar": 8,"baz": 9}''' | ||
|
||
json_lines_extra_spaces = '''\ | ||
{"foo": 1,"bar": 2,"baz": 3} | ||
{"foo": 4,"bar": 5,"baz": 6} | ||
{"foo": 7,"bar": 8,"baz": 9} | ||
''' | ||
|
||
def test_load_pretty_json(self): | ||
""" | ||
Test with pretty JSON | ||
""" | ||
expected = {'foo': 1, 'bar': 2, 'baz': 3} | ||
self.assertEqual(load_json(self.pretty_json), expected) | ||
|
||
def test_load_compact_json(self): | ||
""" | ||
Test with compact JSON | ||
""" | ||
expected = {'foo': 1, 'bar': 2, 'baz': 3} | ||
self.assertEqual(load_json(self.compact_json), expected) | ||
|
||
def test_load_json_lines(self): | ||
""" | ||
Test with JSON Lines | ||
""" | ||
expected = [{'foo': 1, 'bar': 2, 'baz': 3}, {'foo': 4, 'bar': 5, 'baz': 6}, {'foo': 7, 'bar': 8, 'baz': 9}] | ||
self.assertEqual(load_json(self.json_lines), expected) | ||
|
||
def test_load_json_lines_with_extra_whitespace(self): | ||
""" | ||
Test with JSON Lines with extra blank lines and whitespace | ||
""" | ||
expected = [{'foo': 1, 'bar': 2, 'baz': 3}, {'foo': 4, 'bar': 5, 'baz': 6}, {'foo': 7, 'bar': 8, 'baz': 9}] | ||
self.assertEqual(load_json(self.json_lines_extra_spaces), expected) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |