Low probability failure in test/test_extras/test_infixowl/test_restriction.py::test_restriction_str_and_hash
· Issue #2030 · RDFLib/rdflib (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
Failures can be seen in these GitHub actions runs:
- https://github.com/RDFLib/rdflib/runs/7377860761?check_suite_focus=true
- https://github.com/RDFLib/rdflib/runs/7377860681?check_suite_focus=true
________________________ test_restriction_str_and_hash _________________________
graph = <Graph identifier=http://example.org/vocab/context0 (<class 'rdflib.graph.Graph'>)>
def test_restriction_str_and_hash(graph):
r1 = (
(Property(EXNS.someProp, baseType=OWL.DatatypeProperty))
@ some
@ (Class(EXNS.Foo))
)
assert str(r1) == "( ex:someProp SOME ex:Foo )"
sg = Graph()
sg.bind("ex", EXNS)
r1.serialize(sg)
assert r1.isPrimitive() is False
> assert len(str(r1.__hash__())) > 17
E AssertionError: assert 16 > 17
E + where 16 = len('6777726393218724')
E + where '6777726393218724' = str(6777726393218724)
E + where 6777726393218724 = <bound method Restriction.__hash__ of ( ex:someProp SOME ex:Foo )>()
E + where <bound method Restriction.__hash__ of ( ex:someProp SOME ex:Foo )> = ( ex:someProp SOME ex:Foo ).__hash__
test/test_extras/test_infixowl/test_restriction.py:39: AssertionError
This command seems to reproduce this failure at least once, I got 3 failures on my last run:
for (( index=0; index<1000; index++ )); do task test -- test/test_extras/test_infixowl/test_restriction.py::test_restriction_str_and_hash; done
I'm guessing this is somehow related to python hash value which by default will be different for different instances.
CC: @gjhiggins