Commit 41f2c8b5 authored by Dr.李's avatar Dr.李

make universe comparing more consistent

parent 4e1d09c0
...@@ -40,7 +40,8 @@ class Universe(object): ...@@ -40,7 +40,8 @@ class Universe(object):
return self.name == rhs.name \ return self.name == rhs.name \
and list_eq(self.base_universe, rhs.base_universe) \ and list_eq(self.base_universe, rhs.base_universe) \
and list_eq(self.exclude_universe, rhs.exclude_universe) \ and list_eq(self.exclude_universe, rhs.exclude_universe) \
and list_eq(self.special_codes, rhs.special_codes) and list_eq(self.special_codes, rhs.special_codes) \
and str(self.filter_cond) == str(rhs.filter_cond)
@property @property
def is_filtered(self): def is_filtered(self):
......
...@@ -26,6 +26,10 @@ class TestUniverse(unittest.TestCase): ...@@ -26,6 +26,10 @@ class TestUniverse(unittest.TestCase):
universe2 = Universe('custom', ['zz500'], filter_cond=filter_cond) universe2 = Universe('custom', ['zz500'], filter_cond=filter_cond)
self.assertEqual(universe1, universe2) self.assertEqual(universe1, universe2)
universe1 = Universe('custom', ['zz500'], filter_cond=LAST('x') > 1.)
universe2 = Universe('custom', ['zz500'], filter_cond=LAST('x') > 2.)
self.assertNotEqual(universe1, universe2)
def test_universe_persistence(self): def test_universe_persistence(self):
universe = Universe('custom', ['zz500']) universe = Universe('custom', ['zz500'])
univ_desc = universe.save() univ_desc = universe.save()
...@@ -40,3 +44,4 @@ class TestUniverse(unittest.TestCase): ...@@ -40,3 +44,4 @@ class TestUniverse(unittest.TestCase):
self.assertEqual(universe.name, loaded_universe.name) self.assertEqual(universe.name, loaded_universe.name)
self.assertListEqual(universe.base_universe, loaded_universe.base_universe) self.assertListEqual(universe.base_universe, loaded_universe.base_universe)
self.assertEqual(str(universe.filter_cond), str(loaded_universe.filter_cond))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment