Ejemplo n.º 1
0
 def test_extract_filter_valid_all(self):
     for x in constants.FILTER_MAPS:
         for y in x['human']:
             z = utils.extract_filter('Sensor1, that {}:test value'.format(y))
             self.assertTrue(z)
             self.assertEquals(len(z), 2)
             self.assertEquals(z[0], 'Sensor1')
             self.assertIn('test value', z[1]['value'])
Ejemplo n.º 2
0
 def test_extract_filter_valid(self):
     s = 'Sensor1, that is:.*'
     exp = (
         'Sensor1',
         {'operator': 'RegexMatch', 'not_flag': 0, 'value': '.*'}
     )
     r = utils.extract_filter(s)
     self.assertEquals(r, exp)
Ejemplo n.º 3
0
 def test_extract_filter_invalid(self):
     s = 'Sensor1, that meets:.*'
     e = "Filter .* is not a valid filter!"
     with self.assertRaisesRegexp(HumanParserError, e):
         utils.extract_filter(s)
Ejemplo n.º 4
0
 def test_extract_filter_nofilter(self):
     s = 'Sensor1'
     exp = ('Sensor1', {})
     r = utils.extract_filter(s)
     self.assertEquals(r, exp)