From 4e600685882fc228fa0b66919d295ec8616c7a1f Mon Sep 17 00:00:00 2001 From: Eric Moyer Date: Sun, 29 Jul 2018 15:15:49 -0400 Subject: [PATCH] Fix proper_subset when other shares boundary Without this fix, proper_subset gives the wrong answer both intervals share one boundary Interval(4, 6).proper_subset(Interval(4, 7)) should return True, but without this fix, it returns False --- recipes/Python/576816_Interval/recipe-576816.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/Python/576816_Interval/recipe-576816.py b/recipes/Python/576816_Interval/recipe-576816.py index 11fe0ca22..08258d34d 100644 --- a/recipes/Python/576816_Interval/recipe-576816.py +++ b/recipes/Python/576816_Interval/recipe-576816.py @@ -84,7 +84,8 @@ def subset(self, other): def proper_subset(self, other): "@return: True iff self is proper subset of other." - return self.start > other.start and self.end < other.end + return ((self.start > other.start and self.end <= other.end) or + (self.start >= other.start and self.end < other.end)) def empty(self):