@@ -122,11 +122,11 @@ def test_node_equality(g1, id1, eid1, props1, g2, id2, eid2, props2):
122122def test_node_hashing (legacy_id ):
123123 g = Graph ()
124124 node_1 = Node (g , "1234" + ("abc" if not legacy_id else "" ),
125- 1234 if legacy_id else None )
125+ 1234 )
126126 node_2 = Node (g , "1234" + ("abc" if not legacy_id else "" ),
127- 1234 if legacy_id else None )
127+ 1234 )
128128 node_3 = Node (g , "5678" + ("abc" if not legacy_id else "" ),
129- 5678 if legacy_id else None )
129+ 5678 )
130130 assert hash (node_1 ) == hash (node_2 )
131131 assert hash (node_1 ) != hash (node_3 )
132132
@@ -145,7 +145,7 @@ def test_node_v1_repr():
145145def test_node_v2_repr (legacy_id ):
146146 g = Graph ()
147147 gh = Graph .Hydrator (g )
148- id_ = 1234 if legacy_id else None
148+ id_ = 1234
149149 element_id = str (id_ ) if legacy_id else "foobar"
150150 alice = gh .hydrate_node (id_ , {"Person" }, {"name" : "Alice" }, element_id )
151151 assert repr (alice ) == (
@@ -180,16 +180,16 @@ def test_can_create_relationship_v2(legacy_id):
180180 g = Graph ()
181181 gh = Graph .Hydrator (g )
182182 alice = gh .hydrate_node (
183- 1 if legacy_id else None , {"Person" }, {"name" : "Alice" , "age" : 33 },
183+ 1 , {"Person" }, {"name" : "Alice" , "age" : 33 },
184184 "1" if legacy_id else "alice"
185185 )
186186 bob = gh .hydrate_node (
187- 2 if legacy_id else None , {"Person" }, {"name" : "Bob" , "age" : 44 },
187+ 2 , {"Person" }, {"name" : "Bob" , "age" : 44 },
188188 "2" if legacy_id else "bob"
189189 )
190190 alice_knows_bob = gh .hydrate_relationship (
191- 1 if legacy_id else None ,
192- 1 if legacy_id else None , 2 if legacy_id else None ,
191+ 1 ,
192+ 1 , 2 ,
193193 "KNOWS" , {"since" : 1999 },
194194 "1" if legacy_id else "alice_knows_bob" ,
195195 "1" if legacy_id else "alice" , "2" if legacy_id else "bob"
@@ -226,16 +226,16 @@ def test_relationship_v2_repr(legacy_id):
226226 g = Graph ()
227227 gh = Graph .Hydrator (g )
228228 alice = gh .hydrate_node (
229- 1 if legacy_id else None , {"Person" }, {"name" : "Alice" },
229+ 1 , {"Person" }, {"name" : "Alice" },
230230 "1" if legacy_id else "alice"
231231 )
232232 bob = gh .hydrate_node (
233- 2 if legacy_id else None , {"Person" }, {"name" : "Bob" },
233+ 2 , {"Person" }, {"name" : "Bob" },
234234 "2" if legacy_id else "bob"
235235 )
236236 alice_knows_bob = gh .hydrate_relationship (
237- 1 if legacy_id else None ,
238- 1 if legacy_id else None , 2 if legacy_id else None ,
237+ 1 ,
238+ 1 , 2 ,
239239 "KNOWS" , {"since" : 1999 },
240240 "1" if legacy_id else "alice_knows_bob" ,
241241 "1" if legacy_id else "alice" , "2" if legacy_id else "bob"
@@ -278,27 +278,27 @@ def test_can_create_path_v2(legacy_id):
278278 g = Graph ()
279279 gh = Graph .Hydrator (g )
280280 alice = gh .hydrate_node (
281- 1 if legacy_id else None , {"Person" }, {"name" : "Alice" , "age" : 33 },
281+ 1 , {"Person" }, {"name" : "Alice" , "age" : 33 },
282282 "1" if legacy_id else "alice"
283283 )
284284 bob = gh .hydrate_node (
285- 2 if legacy_id else None , {"Person" }, {"name" : "Bob" , "age" : 44 },
285+ 2 , {"Person" }, {"name" : "Bob" , "age" : 44 },
286286 "2" if legacy_id else "bob"
287287 )
288288 carol = gh .hydrate_node (
289- 3 if legacy_id else None , {"Person" }, {"name" : "Carol" , "age" : 55 },
289+ 3 , {"Person" }, {"name" : "Carol" , "age" : 55 },
290290 "3" if legacy_id else "carol"
291291 )
292292 alice_knows_bob = gh .hydrate_relationship (
293- 1 if legacy_id else None ,
294- 1 if legacy_id else None , 2 if legacy_id else None ,
293+ 1 ,
294+ 1 , 2 ,
295295 "KNOWS" , {"since" : 1999 }, "1" if legacy_id else "alice_knows_bob" ,
296296 "1" if legacy_id else "alice" , "2" if legacy_id else "bob"
297297
298298 )
299299 carol_dislikes_bob = gh .hydrate_relationship (
300- 2 if legacy_id else None ,
301- 3 if legacy_id else None , 2 if legacy_id else None ,
300+ 2 ,
301+ 3 , 2 ,
302302 "DISLIKES" , {}, "2" if legacy_id else "carol_dislikes_bob" ,
303303 "3" if legacy_id else "carol" , "2" if legacy_id else "bob"
304304 )
@@ -364,26 +364,26 @@ def test_path_v2_equality(legacy_id):
364364 g = Graph ()
365365 gh = Graph .Hydrator (g )
366366 alice = gh .hydrate_node (
367- 1 if legacy_id else None , {"Person" }, {"name" : "Alice" , "age" : 33 },
367+ 1 , {"Person" }, {"name" : "Alice" , "age" : 33 },
368368 "1" if legacy_id else "alice"
369369 )
370370 _bob = gh .hydrate_node (
371- 2 if legacy_id else None , {"Person" }, {"name" : "Bob" , "age" : 44 },
371+ 2 , {"Person" }, {"name" : "Bob" , "age" : 44 },
372372 "2" if legacy_id else "bob"
373373 )
374374 _carol = gh .hydrate_node (
375- 3 if legacy_id else None , {"Person" }, {"name" : "Carol" , "age" : 55 },
375+ 3 , {"Person" }, {"name" : "Carol" , "age" : 55 },
376376 "3" if legacy_id else "carol"
377377 )
378378 alice_knows_bob = gh .hydrate_relationship (
379- 1 if legacy_id else None ,
380- 1 if legacy_id else None , 2 if legacy_id else None ,
379+ 1 ,
380+ 1 , 2 ,
381381 "KNOWS" , {"since" : 1999 }, "1" if legacy_id else "alice_knows_bob" ,
382382 "1" if legacy_id else "alice" , "2" if legacy_id else "bob"
383383 )
384384 carol_dislikes_bob = gh .hydrate_relationship (
385- 2 if legacy_id else None ,
386- 3 if legacy_id else None , 2 if legacy_id else None ,
385+ 2 ,
386+ 3 , 2 ,
387387 "DISLIKES" , {}, "2" if legacy_id else "carol_dislikes_bob" ,
388388 "3" if legacy_id else "carol" , "2" if legacy_id else "bob"
389389 )
@@ -412,26 +412,26 @@ def test_path_v2_hashing(legacy_id):
412412 g = Graph ()
413413 gh = Graph .Hydrator (g )
414414 alice = gh .hydrate_node (
415- 1 if legacy_id else None , {"Person" }, {"name" : "Alice" , "age" : 33 },
415+ 1 , {"Person" }, {"name" : "Alice" , "age" : 33 },
416416 "1" if legacy_id else "alice"
417417 )
418418 _bob = gh .hydrate_node (
419- 2 if legacy_id else None , {"Person" }, {"name" : "Bob" , "age" : 44 },
419+ 2 , {"Person" }, {"name" : "Bob" , "age" : 44 },
420420 "2" if legacy_id else "bob"
421421 )
422422 _carol = gh .hydrate_node (
423- 3 if legacy_id else None , {"Person" }, {"name" : "Carol" , "age" : 55 },
423+ 3 , {"Person" }, {"name" : "Carol" , "age" : 55 },
424424 "3" if legacy_id else "carol"
425425 )
426426 alice_knows_bob = gh .hydrate_relationship (
427- 1 if legacy_id else None ,
428- 1 if legacy_id else None , 2 if legacy_id else None ,
427+ 1 ,
428+ 1 , 2 ,
429429 "KNOWS" , {"since" : 1999 }, "1" if legacy_id else "alice_knows_bob" ,
430430 "1" if legacy_id else "alice" , "2" if legacy_id else "bob"
431431 )
432432 carol_dislikes_bob = gh .hydrate_relationship (
433- 2 if legacy_id else None ,
434- 3 if legacy_id else None , 2 if legacy_id else None ,
433+ 2 ,
434+ 3 , 2 ,
435435 "DISLIKES" , {}, "2" if legacy_id else "carol_dislikes_bob" ,
436436 "3" if legacy_id else "carol" , "2" if legacy_id else "bob"
437437 )
@@ -462,27 +462,27 @@ def test_path_v2_repr(legacy_id):
462462 g = Graph ()
463463 gh = Graph .Hydrator (g )
464464 alice = gh .hydrate_node (
465- 1 if legacy_id else None , {"Person" }, {"name" : "Alice" },
465+ 1 , {"Person" }, {"name" : "Alice" },
466466 "1" if legacy_id else "alice"
467467
468468 )
469469 bob = gh .hydrate_node (
470- 2 if legacy_id else None , {"Person" }, {"name" : "Bob" },
470+ 2 , {"Person" }, {"name" : "Bob" },
471471 "2" if legacy_id else "bob"
472472
473473 )
474474 carol = gh .hydrate_node (
475- 3 if legacy_id else None , {"Person" }, {"name" : "Carol" },
475+ 3 , {"Person" }, {"name" : "Carol" },
476476 "3" if legacy_id else "carol"
477477
478478 )
479479 alice_knows_bob = gh .hydrate_relationship (
480- 1 if legacy_id else None , alice .id , bob .id , "KNOWS" , {"since" : 1999 },
480+ 1 , alice .id , bob .id , "KNOWS" , {"since" : 1999 },
481481 "1" if legacy_id else "alice_knows_bob" ,
482482 alice .element_id , bob .element_id
483483 )
484484 carol_dislikes_bob = gh .hydrate_relationship (
485- 2 if legacy_id else None , carol .id , bob .id , "DISLIKES" , {},
485+ 2 , carol .id , bob .id , "DISLIKES" , {},
486486 "2" if legacy_id else "carol_dislikes_bob" ,
487487 carol .element_id , bob .element_id
488488 )
0 commit comments