44are checked against set algebra over the single-filter results (`&` = intersection, `|` = union,
55`~` = complement), which is how node collections already behave. The combination classes that are
66known broken on edges are pinned by `test_broken_combination_classes_are_still_broken` — when a fix
7- lands, that test fails and the class moves into the working set by deleting its rule below."""
7+ lands, that test fails and the class moves into the working set by deleting its rule below.
8+ """
89
910from itertools import combinations
1011
@@ -149,7 +150,9 @@ def check(graph):
149150 ("filter()" , _ids (graph .filter (expr ).edges )),
150151 ):
151152 if got != want :
152- mismatches .append (f"[{ path } ] { label } : got { sorted (got )} want { sorted (want )} " )
153+ mismatches .append (
154+ f"[{ path } ] { label } : got { sorted (got )} want { sorted (want )} "
155+ )
153156 assert not mismatches , "\n " .join (mismatches )
154157
155158 return check
@@ -166,7 +169,9 @@ def check(graph):
166169 working ["~edge_prop" ] = ~ atoms ["edge_prop" ]
167170 for label , expr in working .items ():
168171 indexed = sorted (e .id for es in graph .nodes .edges [expr ] for e in es )
169- reference = sorted (e .id for es in graph .filter (expr ).nodes .edges for e in es )
172+ reference = sorted (
173+ e .id for es in graph .filter (expr ).nodes .edges for e in es
174+ )
170175 assert indexed == reference , label
171176
172177 return check
@@ -248,7 +253,8 @@ def check(graph):
248253@with_variants (_init )
249254def test_broken_combination_classes_are_still_broken ():
250255 """One discriminating representative per known-broken class. When a class is fixed this fails:
251- delete its `_*_is_broken` rule above so the combinations join the set-algebra test."""
256+ delete its `_*_is_broken` rule above so the combinations join the set-algebra test.
257+ """
252258
253259 def check (graph ):
254260 atoms , single = _atoms (), _singles (graph )
@@ -266,23 +272,33 @@ def check(graph):
266272 atoms ["edge_prop" ] | atoms ["node_prop" ],
267273 single ["edge_prop" ] | single ["node_prop" ],
268274 ),
269- "not of a view returns every edge" : (~ atoms ["layer" ], every - single ["layer" ]),
275+ "not of a view returns every edge" : (
276+ ~ atoms ["layer" ],
277+ every - single ["layer" ],
278+ ),
270279 "not of a node filter is not the complement" : (
271280 ~ atoms ["node_name" ],
272281 every - single ["node_name" ],
273282 ),
274283 }
275284 fixed = []
276285 for label , (expr , want ) in representatives .items ():
277- if _ids (graph .edges [expr ]) == want and _ids (graph .filter (expr ).edges ) == want :
286+ if (
287+ _ids (graph .edges [expr ]) == want
288+ and _ids (graph .filter (expr ).edges ) == want
289+ ):
278290 fixed .append (label )
279- nested = sorted (e .id for es in graph .nodes .edges [atoms ["node_prop" ]] for e in es )
280- nested_ref = sorted (e .id for es in graph .filter (atoms ["node_prop" ]).nodes .edges for e in es )
291+ nested = sorted (
292+ e .id for es in graph .nodes .edges [atoms ["node_prop" ]] for e in es
293+ )
294+ nested_ref = sorted (
295+ e .id for es in graph .filter (atoms ["node_prop" ]).nodes .edges for e in es
296+ )
281297 per_node = _ids (graph .node ("a" ).edges [atoms ["node_prop" ]])
282298 if nested == nested_ref and per_node == frozenset ():
283299 fixed .append ("per-node/nested edges with a node filter" )
284- assert not fixed , (
285- f"now FIXED: { fixed } — move the class into the working set by deleting its rule"
286- )
300+ assert (
301+ not fixed
302+ ), f"now FIXED: { fixed } — move the class into the working set by deleting its rule"
287303
288304 return check
0 commit comments