Skip to content

Commit 0d40c76

Browse files
author
Tim O'Farrell
committed
Blackened
1 parent c852dc0 commit 0d40c76

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

tests/test_json_urley_additional.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
import unittest
22
from json_urley import query_str_to_json_obj, json_obj_to_query_str, JsonUrleyError
33

4-
class TestJsonUrleyAdditional(unittest.TestCase):
54

5+
class TestJsonUrleyAdditional(unittest.TestCase):
66
def test_nested_object_with_array(self):
77
json_obj = {"user": {"name": "John", "scores": [85, 90, 95]}}
88
query_str = json_obj_to_query_str(json_obj)
9-
self.assertEqual(query_str, "user.name=John&user.scores=85&user.scores=90&user.scores=95")
9+
self.assertEqual(
10+
query_str, "user.name=John&user.scores=85&user.scores=90&user.scores=95"
11+
)
1012
result = query_str_to_json_obj(query_str)
1113
self.assertEqual(result, json_obj)
1214

1315
def test_array_of_objects(self):
1416
json_obj = {"users": [{"name": "John", "age": 30}, {"name": "Jane", "age": 25}]}
1517
query_str = json_obj_to_query_str(json_obj)
16-
self.assertEqual(query_str, "users~a.n.name=John&users.e.age=30&users.n.name=Jane&users.e.age=25")
18+
self.assertEqual(
19+
query_str,
20+
"users~a.n.name=John&users.e.age=30&users.n.name=Jane&users.e.age=25",
21+
)
1722
result = query_str_to_json_obj(query_str)
1823
self.assertEqual(result, json_obj)
1924

@@ -41,7 +46,9 @@ def test_deeply_nested_structure(self):
4146
def test_mixed_types_in_array(self):
4247
json_obj = {"mixed": [1, "two", True, None, 3.14]}
4348
query_str = json_obj_to_query_str(json_obj)
44-
self.assertEqual(query_str, "mixed=1&mixed=two&mixed=true&mixed=null&mixed=3.14")
49+
self.assertEqual(
50+
query_str, "mixed=1&mixed=two&mixed=true&mixed=null&mixed=3.14"
51+
)
4552
result = query_str_to_json_obj(query_str)
4653
self.assertEqual(result, json_obj)
4754

@@ -53,5 +60,6 @@ def test_conflicting_types(self):
5360
with self.assertRaises(JsonUrleyError):
5461
query_str_to_json_obj("key=value&key~i=123")
5562

56-
if __name__ == '__main__':
63+
64+
if __name__ == "__main__":
5765
unittest.main()

0 commit comments

Comments
 (0)