Skip to content

Commit 4c7726d

Browse files
remove tests regarding null id on nodes/relationships
1 parent 3d7826f commit 4c7726d

File tree

3 files changed

+44
-49
lines changed

3 files changed

+44
-49
lines changed

testkitbackend/test_config.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@
5151
"Optimization:PullPipelining": true,
5252
"Optimization:ResultListFetchAll": "The idiomatic way to cast to list is indistinguishable from iterating over the result.",
5353

54-
"Detail:NullOnMissingId": true,
55-
5654
"ConfHint:connection.recv_timeout_seconds": true,
5755

5856
"Backend:RTFetch": true,

tests/unit/common/test_data.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ def test_can_hydrate_v1_node_structure():
4040
assert alice.get("name") == "Alice"
4141

4242

43-
@pytest.mark.parametrize("with_id", (True, False))
44-
def test_can_hydrate_v2_node_structure(with_id):
43+
def test_can_hydrate_v2_node_structure():
4544
hydrant = DataHydrator()
4645

47-
id_ = 123 if with_id else None
46+
id_ = 123
4847

4948
struct = Structure(b'N', id_, ["Person"], {"name": "Alice"}, "abc")
5049
alice, = hydrant.hydrate([struct])
@@ -78,14 +77,12 @@ def test_can_hydrate_v1_relationship_structure():
7877
assert rel.get("since") == 1999
7978

8079

81-
@pytest.mark.parametrize("with_ids", (True, False))
82-
def test_can_hydrate_v2_relationship_structure(with_ids):
80+
def test_can_hydrate_v2_relationship_structure():
8381
hydrant = DataHydrator()
8482

85-
id_ = 123 if with_ids else None
86-
start_id = 456 if with_ids else None
87-
end_id = 789 if with_ids else None
88-
83+
id_ = 123
84+
start_id = 456
85+
end_id = 789
8986
struct = Structure(b'R', id_, start_id, end_id, "KNOWS", {"since": 1999},
9087
"abc", "def", "ghi")
9188

tests/unit/common/test_types.py

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ def test_node_equality(g1, id1, eid1, props1, g2, id2, eid2, props2):
122122
def 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():
145145
def 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

Comments
 (0)