Skip to content

Equality of Path objects cannot be checked #2281

@alhyss

Description

@alhyss

Hi!
Since RDFLib 6.2.0, it's no longer possible to check the equality of two Path objects with ==.

With RDFLib 6.1.1:

>>> from rdflib import DCTERMS, DCAT
>>> DCTERMS.temporal / DCAT.endDate == DCTERMS.temporal / DCAT.endDate
True

With RDFLib 6.2.0 and 6.3.0:

>>> from rdflib import DCTERMS, DCAT
>>> DCTERMS.temporal / DCAT.endDate == DCTERMS.temporal / DCAT.endDate
False

This is most likely due to PR #1528. The __eq__() method of the Path class was removed, while functools.total_ordering apparently requires it:

The class must define one of __lt__(), __le__(), __gt__(), or __ge__(). In addition, the class should supply an __eq__() method.

This also explains why membership tests currently don't work, as mentionned in the issue #2242.

Adding back the __eq__() method from RDFLib 6.1.1 should solve everything?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreRelates to core functionality of RDFLib, i.e. `rdflib.{graph,store,term}`regressionSomething stopped working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions