From 99a8a0f8b958fb8c7e5d579c48534c73016cc69c Mon Sep 17 00:00:00 2001 From: Florian Ludwig Date: Mon, 31 Aug 2020 19:56:09 +0200 Subject: [PATCH] there is no use-case of comparing a Literal with None --- rdflib/term.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/rdflib/term.py b/rdflib/term.py index 32ec6af44..02702e5cd 100644 --- a/rdflib/term.py +++ b/rdflib/term.py @@ -810,8 +810,6 @@ def __gt__(self, other): >>> Literal("a", lang="en") > Literal("a", lang="fr") False """ - if other is None: - return True # Everything is greater than None if isinstance(other, Literal): if ( @@ -870,8 +868,6 @@ def __gt__(self, other): return NotImplemented # we can only compare to nodes def __lt__(self, other): - if other is None: - return False # Nothing is less than None if isinstance(other, Literal): try: return not self.__gt__(other) and not self.eq(other) @@ -1010,8 +1006,7 @@ def __eq__(self, other): """ if self is other: return True - if other is None: - return False + if isinstance(other, Literal): return ( self.datatype == other.datatype