Skip to content

Commit eebdb76

Browse files
authored
Add some tests for core.response.flatten_custom (#637)
Relates to #597
1 parent c84ca29 commit eebdb76

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tests/unit/test_response.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,23 @@
22
from unittest.mock import Mock, patch
33

44
from pynetbox.core.endpoint import Endpoint
5-
from pynetbox.core.response import Record, RecordSet
5+
from pynetbox.core.response import Record, RecordSet, flatten_custom
6+
7+
8+
class FlattenCustomTest(unittest.TestCase):
9+
def test_flatten_custom(self):
10+
test_dicts = [
11+
{"foo0": []},
12+
{"foo1": [{"a": "b"}]},
13+
{"foo2": [{"a": "b", "c": "d"}]},
14+
{"foo3": 123},
15+
{"foo4": "a"},
16+
{"foo5": {"a": "b"}},
17+
{"foo6": [{"a": "b", "c": "d"}]},
18+
]
19+
for test_dict in test_dicts:
20+
ret = flatten_custom(test_dict)
21+
assert ret == test_dict
622

723

824
class RecordTestCase(unittest.TestCase):

0 commit comments

Comments
 (0)