Skip to content

Commit 8403951

Browse files
committed
Minor simplifications in contain_subset
1 parent b8f7f65 commit 8403951

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

graphql/pyutils/contain_subset.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def contain_subset(expected, actual):
1212
actual_is_dict = issubclass(t_actual, dict)
1313
expected_is_dict = issubclass(t_expected, dict)
1414
both_dicts = actual_is_dict and expected_is_dict
15-
if not (both_dicts) and not (
15+
if not both_dicts and not (
1616
issubclass(t_actual, t_expected) or issubclass(t_expected, t_actual)
1717
):
1818
return False
@@ -22,8 +22,9 @@ def contain_subset(expected, actual):
2222
return False
2323
if isinstance(expected, list):
2424
aa = actual[:]
25-
return all([any([contain_subset(exp, act) for act in aa]) for exp in expected])
26-
for key in expected.keys(): # type: ignore
25+
return all(any(contain_subset(exp, act) for act in aa)
26+
for exp in expected)
27+
for key in expected: # type: ignore
2728
eo = expected[key]
2829
ao = actual.get(key)
2930
if isinstance(eo, obj) and eo is not None and ao is not None:

0 commit comments

Comments
 (0)