From 1d977a2744fb24c6dfdb9ec69f93fdf301308d96 Mon Sep 17 00:00:00 2001 From: Vesna Tanko Date: Tue, 29 Nov 2016 15:00:39 +0100 Subject: [PATCH] Filter: Fixup and test improvement --- Orange/data/filter.py | 2 +- Orange/tests/test_filter.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Orange/data/filter.py b/Orange/data/filter.py index ee5edb824cd..f7fe6b02889 100644 --- a/Orange/data/filter.py +++ b/Orange/data/filter.py @@ -365,7 +365,7 @@ def __call__(self, inst): def __eq__(self, other): return isinstance(other, FilterContinuous) and \ self.column == other.column and self.oper == other.oper and \ - self.oper == other.oper and self.oper == other.oper + self.ref == other.ref and self.max == other.max def __str__(self): if isinstance(self.column, str): diff --git a/Orange/tests/test_filter.py b/Orange/tests/test_filter.py index 30dd699bd84..0fc7a864f15 100644 --- a/Orange/tests/test_filter.py +++ b/Orange/tests/test_filter.py @@ -249,14 +249,22 @@ def test_str(self): def test_eq(self): flt1 = FilterContinuous(1, FilterContinuous.Between, 1, 2) flt2 = FilterContinuous(1, FilterContinuous.Between, 1, 2) + flt3 = FilterContinuous(1, FilterContinuous.Between, 1, 3) self.assertEqual(flt1, flt2) + self.assertNotEqual(flt1, flt3) + self.assertEqual(flt1.__dict__ == flt2.__dict__, flt1 == flt2) + self.assertEqual(flt1.__dict__ == flt3.__dict__, flt1 == flt3) class TestFilterDiscrete(unittest.TestCase): def test_eq(self): flt1 = FilterDiscrete(1, None) flt2 = FilterDiscrete(1, None) + flt3 = FilterDiscrete(2, None) self.assertEqual(flt1, flt2) + self.assertEqual(flt1.__dict__ == flt2.__dict__, flt1 == flt2) + self.assertNotEqual(flt1, flt3) + self.assertEqual(flt1.__dict__ == flt3.__dict__, flt1 == flt3) class TestFilterString(unittest.TestCase):