summaryrefslogtreecommitdiff
path: root/test/test_extras
diff options
context:
space:
mode:
authorGraham Higgins <gjhiggins@users.noreply.github.com>2022-07-18 13:34:31 +0100
committerGitHub <noreply@github.com>2022-07-18 14:34:31 +0200
commit8d5a14ffb39a811add09c41ea2c6a9da3d08325a (patch)
tree0e79ad17d97fc59586f03d8868a72a45fa0f3dfe /test/test_extras
parent8cb0027ab1e9716473a0445ada5b6390df2ed32c (diff)
downloadrdflib-8d5a14ffb39a811add09c41ea2c6a9da3d08325a.tar.gz
fix: InfixOWL: eliminate use of mutable data structures in args (#2033)
Maintenance-positive changes recommended by [flake8-bugbear](https://pypi.org/project/flake8-bugbear/), mostly explicitly indicating unused loop variables with a prefixing underscore (it identified one case where _none_ of the loop variables were being used) and a couple of don't-use-mutable-objects-as-args instances. 1. Added leading underscore to unused loop variables, removed mutable objects from args, (replacing with None and then performing an explicit “if None” assignment in the body of the method). 2. Swapped out an excessively weak, coverage-motivated length test of __hash__() (which was causing intermittent test failures) for an equality test of two runs, fixes issue #2030
Diffstat (limited to 'test/test_extras')
-rw-r--r--test/test_extras/test_infixowl/test_restriction.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/test_extras/test_infixowl/test_restriction.py b/test/test_extras/test_infixowl/test_restriction.py
index ca621a1b..4f022137 100644
--- a/test/test_extras/test_infixowl/test_restriction.py
+++ b/test/test_extras/test_infixowl/test_restriction.py
@@ -36,7 +36,12 @@ def test_restriction_str_and_hash(graph):
r1.serialize(sg)
assert r1.isPrimitive() is False
- assert len(str(r1.__hash__())) > 17
+
+ r1hashfirstrun = r1.__hash__()
+
+ r1hashsecondrun = r1.__hash__()
+
+ assert r1hashfirstrun == r1hashsecondrun
assert list(Property(EXNS.someProp, baseType=None).type) == [
URIRef("http://www.w3.org/2002/07/owl#DatatypeProperty")