Exemplo n.º 1
0
 def setUp(self):
     super(HandlerTests, self).setUp()
     fx0 = checks.Filter({"type": "ObjectFilter", "expression": "x == 0"})
     fy0 = checks.Filter({"type": "ObjectFilter", "expression": "y == 0"})
     bad = checks.Filter({"type": "ObjectFilter", "expression": "y =="})
     self.ok = [fx0, fy0]
     self.bad = [fx0, fy0, bad]
     self.all = [Sample(0, 0), Sample(0, 1), Sample(1, 0), Sample(1, 1)]
Exemplo n.º 2
0
 def testAddFilters(self):
     base_filt = checks.Filter(type="Filter", expression="do nothing")
     self.assertIsInstance(base_filt._filter, filters.Filter)
     obj_filt = checks.Filter(type="ObjectFilter",
                              expression="test is 'ok'")
     self.assertIsInstance(obj_filt._filter, filters.ObjectFilter)
     rdf_filt = checks.Filter(type="RDFFilter",
                              expression="AttributedDict,SSHConfig")
     self.assertIsInstance(rdf_filt._filter, filters.RDFFilter)
Exemplo n.º 3
0
 def testFilter(self):
     kwargs = {"type": "ObjectFilter"}
     filt = checks.Filter(**kwargs)
     self.assertEqual(filt.type, kwargs["type"])
     self.assertIsInstance(filt, checks.Filter)
     # Ensure the filter hook is initialized as well.
     self.assertIsInstance(filt._filter, filters.ObjectFilter)
Exemplo n.º 4
0
 def testFilterWithExpression(self):
     kwargs = {"type": "ObjectFilter", "expression": "do stuff"}
     filt = checks.Filter(**kwargs)
     self.assertIsInstance(filt, checks.Filter)
     self.assertEqual(filt.type, kwargs["type"])
     self.assertEqual(filt.expression, kwargs["expression"])