aplbrain / aplbrain/grand-cypher
duplicated hints leads to duplicated result
- Dominant language
- Python
- Stars
- 129
- Forks
- 17
- PR merge metrics
- PR metrics pending
Description
There seems a bug in `hints`, as hints is duplicated, result is duplicated as well
```python
@pytest.mark.benchmark
@pytest.mark.parametrize("graph_type", ACCEPTED_GRAPH_TYPES)
def test_multiple_nodes_duplicated_hinted(self, graph_type):
"""
Test the case where multiple nodes are hinted
"""
host = graph_type()
host.add_node(1, name="Home")
host.add_node(2, name="Work")
host.add_node(3, name="School")
host.add_node(4, name="Library")
host.add_node(5, name="Park")
host.add_edge(1, 2)
host.add_edge(1, 3)
host.add_edge(2, 4)
host.add_edge(3, 4)
host.add_edge(4, 5)
host.add_edge(5, 1)
qry = """
MATCH (A)-[r]->(B)
RETURN A.name, B.name
"""
gc = GrandCypher(host)
res = gc.run(qry, hints=[{"A": 1, "B": 2}, {"A": 3, "B": 4}, {"A": 1, "B": 2}, {"A": 3, "B": 4}]) # <<<<<<<<< duplicated hints
assert res == {"A.name": ["Home", "School"], "B.name": ["Work", "Library"]}
```
here is the result
```bash
> assert res == {"A.name": ["Home", "School"], "B.name": ["Work", "Library"]}
E AssertionError: assert {'A.name': ['Home', 'School', 'Home', 'School'], 'B.name': ['Work', 'Library', 'Work', 'Library']} == {'A.name': ['Home', 'School'], 'B.name': ['Work', 'Library']}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.