Example #1
0
    def test_get_on_dropped(self):
        f = Interval(interval_metadata=self.im,
                     bounds=[(1, 2)],
                     fuzzy=[(True, False)],
                     metadata={'name': 'sagA'})
        f.drop()

        self.assertEqual(f.fuzzy, [(True, False)])
        self.assertEqual(f.bounds, [(1, 2)])
        self.assertEqual(f.metadata, {'name': 'sagA'})
Example #2
0
    def test_get_on_dropped(self):
        f = Interval(interval_metadata=self.im,
                     bounds=[(1, 2)],
                     fuzzy=[(True, False)],
                     metadata={'name': 'sagA'})
        f.drop()

        self.assertEqual(f.fuzzy, [(True, False)])
        self.assertEqual(f.bounds, [(1, 2)])
        self.assertEqual(f.metadata, {'name': 'sagA'})
Example #3
0
 def test_repr(self):
     f = Interval(interval_metadata=self.im,
                  bounds=[(1, 2)],
                  metadata={'name': 'sagA'})
     exp = (r"Interval\(interval_metadata=<[0-9]+>, bounds=\[\(1, 2\)\],"
            " fuzzy=\[\(False, False\)\], metadata={'name': 'sagA'}\)")
     obs = repr(f)
     self.assertRegex(obs, exp)
     # test for dropped
     f.drop()
     exp = (r"Interval\(dropped=True, bounds=\[\(1, 2\)\],"
            " fuzzy=\[\(False, False\)\], metadata={'name': 'sagA'}\)")
     obs = repr(f)
     self.assertRegex(obs, exp)
Example #4
0
 def test_repr(self):
     f = Interval(interval_metadata=self.im,
                  bounds=[(1, 2)],
                  metadata={'name': 'sagA'})
     exp = (r"Interval\(interval_metadata=<[0-9]+>, bounds=\[\(1, 2\)\],"
            " fuzzy=\[\(False, False\)\], metadata={'name': 'sagA'}\)")
     obs = repr(f)
     self.assertRegex(obs, exp)
     # test for dropped
     f.drop()
     exp = (r"Interval\(dropped=True, bounds=\[\(1, 2\)\],"
            " fuzzy=\[\(False, False\)\], metadata={'name': 'sagA'}\)")
     obs = repr(f)
     self.assertRegex(obs, exp)
Example #5
0
 def test_drop(self):
     f = Interval(interval_metadata=self.im,
                  bounds=[(1, 2)],
                  metadata={'name': 'sagA'})
     f.drop()
     self.assertTrue(f._interval_metadata is None)
     self.assertTrue(f.dropped)
     self.assertTrue(f.bounds, [(1, 2)])
     self.assertTrue(f.metadata, {'name': 'sagA'})
     # test the idempotence
     f.drop()
     self.assertTrue(f._interval_metadata is None)
     self.assertTrue(f.dropped)
     self.assertTrue(f.bounds, [(1, 2)])
     self.assertTrue(f.metadata, {'name': 'sagA'})
Example #6
0
 def test_drop(self):
     f = Interval(interval_metadata=self.im,
                  bounds=[(1, 2)],
                  metadata={'name': 'sagA'})
     f.drop()
     self.assertTrue(f._interval_metadata is None)
     self.assertTrue(f.dropped)
     self.assertTrue(f.bounds, [(1, 2)])
     self.assertTrue(f.metadata, {'name': 'sagA'})
     # test the idempotence
     f.drop()
     self.assertTrue(f._interval_metadata is None)
     self.assertTrue(f.dropped)
     self.assertTrue(f.bounds, [(1, 2)])
     self.assertTrue(f.metadata, {'name': 'sagA'})
Example #7
0
 def test_set_delete_on_dropped(self):
     f = Interval(interval_metadata=self.im,
                  bounds=[(1, 2)],
                  fuzzy=[(True, False)],
                  metadata={'name': 'sagA'})
     f.drop()
     with self.assertRaises(RuntimeError):
         f.fuzzy = None
     with self.assertRaises(RuntimeError):
         f.bounds = [(1, 2)]
     with self.assertRaises(RuntimeError):
         f.metadata = {}
     with self.assertRaises(RuntimeError):
         del f.fuzzy
     with self.assertRaises(RuntimeError):
         del f.metadata
Example #8
0
 def test_set_delete_on_dropped(self):
     f = Interval(interval_metadata=self.im,
                  bounds=[(1, 2)],
                  fuzzy=[(True, False)],
                  metadata={'name': 'sagA'})
     f.drop()
     with self.assertRaises(RuntimeError):
         f.fuzzy = None
     with self.assertRaises(RuntimeError):
         f.bounds = [(1, 2)]
     with self.assertRaises(RuntimeError):
         f.metadata = {}
     with self.assertRaises(RuntimeError):
         del f.fuzzy
     with self.assertRaises(RuntimeError):
         del f.metadata