Beispiel #1
0
 def test_extract_params_missing_seperator(self):
     s = 'Sensor1{v1,v2}, more:stuff,here'
     e = "Parameter v1 missing key/value seperator \(=\)"
     with self.assertRaisesRegexp(HumanParserError, e):
         utils.extract_params(s)
Beispiel #2
0
 def test_extract_params_noparams(self):
     s = 'Sensor1, more:stuff,here'
     exp = ('Sensor1, more:stuff,here', {})
     r = utils.extract_params(s)
     self.assertEquals(r, exp)
Beispiel #3
0
 def test_extract_params_multiparams(self):
     s = 'Sensor1{k1=v1,k2=v2}{}, more:stuff,here'
     e = "More than one parameter \(\{\}\) passed in '.*'"
     with self.assertRaisesRegexp(HumanParserError, e):
         utils.extract_params(s)
Beispiel #4
0
 def test_extract_params(self):
     s = 'Sensor1{k1=v1,k2=v2}, more:stuff,here'
     exp = ('Sensor1, more:stuff,here', {'k2': 'v2', 'k1': 'v1'})
     r = utils.extract_params(s)
     self.assertEquals(r, exp)