Skip to content

Commit 48f3727

Browse files
committed
Revert "removed the two tests temporarily, will add back later"
This reverts commit 2832f62.
1 parent 0591652 commit 48f3727

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

kubernetes/test/test_api_client.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,33 @@ def test_atexit_closes_threadpool(self):
2525
atexit._run_exitfuncs()
2626
self.assertIsNone(client._pool)
2727

28+
def test_deserialize_dict_syntax_compatibility(self):
29+
"""Test ApiClient.__deserialize supports both
30+
dict(str, str) and dict[str, str] syntax"""
31+
client = kubernetes.client.ApiClient()
32+
33+
# Test data
34+
test_data = {
35+
'key1': 'value1',
36+
'key2': 'value2'
37+
}
38+
39+
# Test legacy syntax: dict(str, str)
40+
result_legacy = client._ApiClient__deserialize(test_data, 'dict(str, str)')
41+
self.assertEqual(result_legacy, test_data)
42+
43+
# Test modern syntax: dict[str, str]
44+
result_modern = client._ApiClient__deserialize(test_data, 'dict[str, str]')
45+
self.assertEqual(result_modern, test_data)
46+
47+
# Test nested dict: dict[str, dict[str, str]]
48+
nested_data = {
49+
'outer1': {'inner1': 'value1', 'inner2': 'value2'},
50+
'outer2': {'inner3': 'value3'}
51+
}
52+
result_nested = client._ApiClient__deserialize(nested_data, 'dict[str, dict[str, str]]')
53+
self.assertEqual(result_nested, nested_data)
54+
2855
def test_rest_proxycare(self):
2956

3057
pool = { 'proxy': urllib3.ProxyManager, 'direct': urllib3.PoolManager }

0 commit comments

Comments
 (0)