Skip to content

Commit

Permalink
Add tests for the new fuction
Browse files Browse the repository at this point in the history
  • Loading branch information
gdubicki committed Nov 28, 2021
1 parent 55c7b9f commit d056f04
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,26 @@
def test_json_format():
demo = [{'foo': 'bar'}, {'bar': 'foo'}]
sample = json.dumps(demo, indent=2, separators=(',', ': '))

assert sample == utils.jsonprint(demo), "Json formatting has changed"


def test_parse_python_array():
python_array = [{'foo': 'bar'}, {'bar': 'foo'}]
python_array_as_string = str(python_array)
assert python_array == utils.parse_python(python_array_as_string)


def test_parse_python_dict():
python_dict = {'foo': 'bar'}
python_dict_as_string = str(python_dict)
assert python_dict == utils.parse_python(python_dict_as_string)


def test_parse_python_string():
a_string = "foobar"
assert a_string == utils.parse_python(a_string)


def test_format_val_str():
x = "some string"
assert x == utils.formatvalue(x), "Should return same value"
Expand Down

0 comments on commit d056f04

Please sign in to comment.