def _add_param_statistic_values(self, first_element, value):
     # StatisticValues is a struct type so we are parsing
     # a csv keyval list into a dict.
     statistics = {}
     for pair in split_on_commas(value):
         key, value = pair.split('=')
         statistics[key] = value
     first_element['StatisticValues'] = statistics
 def _add_param_statistic_values(self, first_element, value):
     # StatisticValues is a struct type so we are parsing
     # a csv keyval list into a dict.
     statistics = {}
     for pair in split_on_commas(value):
         key, value = pair.split('=')
         statistics[key] = value
     first_element['StatisticValues'] = statistics
 def _add_param_dimensions(self, first_element, value):
     # Dimensions needs a little more processing.  We support
     # the key=value,key2=value syntax so we need to parse
     # that.
     dimensions = []
     for pair in split_on_commas(value):
         key, value = pair.split('=')
         dimensions.append({'Name': key, 'Value': value})
     first_element['Dimensions'] = dimensions
Exemplo n.º 4
0
 def _add_param_dimensions(self, first_element, value):
     # Dimensions needs a little more processing.  We support
     # the key=value,key2=value syntax so we need to parse
     # that.
     dimensions = []
     for pair in split_on_commas(value):
         key, value = pair.split('=')
         dimensions.append({'Name': key, 'Value': value})
     first_element['Dimensions'] = dimensions
Exemplo n.º 5
0
 def _add_param_statistic_values(self, first_element, value):
     # StatisticValues is a struct type so we are parsing
     # a csv keyval list into a dict.
     statistics = {}
     for pair in split_on_commas(value):
         key, value = pair.split('=')
         # There are four supported values: Maximum, Minimum, SampleCount,
         # and Sum.  All of them are documented as a type double so we can
         # convert these to a decimal value to preserve precision.
         statistics[key] = decimal.Decimal(value)
     first_element['StatisticValues'] = statistics
Exemplo n.º 6
0
 def _add_param_statistic_values(self, first_element, value):
     # StatisticValues is a struct type so we are parsing
     # a csv keyval list into a dict.
     statistics = {}
     for pair in split_on_commas(value):
         key, value = pair.split('=')
         # There are four supported values: Maximum, Minimum, SampleCount,
         # and Sum.  All of them are documented as a type double so we can
         # convert these to a decimal value to preserve precision.
         statistics[key] = decimal.Decimal(value)
     first_element['StatisticValues'] = statistics
Exemplo n.º 7
0
 def test_end_bracket_in_value(self):
     self.assertEqual(split_on_commas('foo,bar=[foo,*[biz]*,baz]'),
                      ['foo', 'bar=foo,*[biz]*,baz'])
Exemplo n.º 8
0
 def test_missing_bracket2(self):
     self.assertEqual(split_on_commas('foo,bar=a],baz'),
                      ['foo', 'bar=a]', 'baz'])
Exemplo n.º 9
0
 def test_square_brackets(self):
     self.assertEqual(split_on_commas('foo,bar=["a=b",\'2\',c=d],baz'),
                      ['foo', 'bar=a=b,2,c=d', 'baz'])
Exemplo n.º 10
0
 def test_trailing_commas(self):
     self.assertEqual(split_on_commas('foo,'), ['foo', ''])
Exemplo n.º 11
0
 def test_escape_quotes(self):
     self.assertEqual(split_on_commas('foo,bar=1\,2\,3,baz'),
                      ['foo', 'bar=1,2,3', 'baz'])
Exemplo n.º 12
0
 def test_inner_quote_split_with_equals(self):
     self.assertEqual(split_on_commas('foo,bar="Foo:80/bar?a=b",baz'),
                      ['foo', 'bar=Foo:80/bar?a=b', 'baz'])
Exemplo n.º 13
0
 def test_single_quote(self):
     self.assertEqual(split_on_commas("foo,bar='1,2,3',baz"),
                      ['foo', 'bar=1,2,3', 'baz'])
Exemplo n.º 14
0
 def test_square_brackets(self):
     self.assertEqual(split_on_commas('foo,bar=["a=b",\'2\',c=d],baz'),
                      ['foo', 'bar=a=b,2,c=d', 'baz'])
Exemplo n.º 15
0
 def test_escape_backslash(self):
     self.assertEqual(split_on_commas('foo,bar\\\\,baz\\\\,qux'),
                      ['foo', 'bar\\', 'baz\\', 'qux'])
Exemplo n.º 16
0
 def test_trailing_commas(self):
     self.assertEqual(split_on_commas('foo,'), ['foo', ''])
Exemplo n.º 17
0
 def test_no_commas(self):
     self.assertEqual(split_on_commas('foo'), ['foo'])
Exemplo n.º 18
0
 def test_escape_quotes(self):
     self.assertEqual(split_on_commas('foo,bar=1\,2\,3,baz'),
                      ['foo', 'bar=1,2,3', 'baz'])
Exemplo n.º 19
0
 def test_single_quoted_inner_value_with_no_commas(self):
     self.assertEqual(split_on_commas("foo,bar='BAR',baz"),
                      ['foo', 'bar=BAR', 'baz'])
Exemplo n.º 20
0
 def test_inner_quote_split_with_equals(self):
     self.assertEqual(split_on_commas('foo,bar="Foo:80/bar?a=b",baz'),
                      ['foo', 'bar=Foo:80/bar?a=b', 'baz'])
Exemplo n.º 21
0
 def test_normal_csv_split(self):
     self.assertEqual(split_on_commas('foo,bar,baz'),
                      ['foo', 'bar', 'baz'])
Exemplo n.º 22
0
 def test_mixing_double_single_quotes_before_first_comma(self):
     self.assertEqual(split_on_commas("""foo,bar="1','2',3",baz"""),
                      ['foo', "bar=1','2',3", 'baz'])
Exemplo n.º 23
0
 def test_quoted_square_brackets(self):
     self.assertEqual(split_on_commas('foo,bar="[blah]",c=d],baz'),
                      ['foo', 'bar=[blah]', 'c=d]', 'baz'])
Exemplo n.º 24
0
 def test_mixing_double_single_quotes_before_first_comma(self):
     self.assertEqual(split_on_commas("""foo,bar="1','2',3",baz"""),
                      ['foo', "bar=1','2',3", 'baz'])
Exemplo n.º 25
0
 def test_missing_bracket2(self):
     self.assertEqual(split_on_commas('foo,bar=a],baz'),
                      ['foo', 'bar=a]', 'baz'])
Exemplo n.º 26
0
 def test_single_quoted_inner_value_with_no_commas(self):
     self.assertEqual(split_on_commas("foo,bar='BAR',baz"),
                      ['foo', 'bar=BAR', 'baz'])
Exemplo n.º 27
0
 def test_bracket_in_middle(self):
     self.assertEqual(split_on_commas('foo,bar=a[b][c],baz'),
                      ['foo', 'bar=a[b][c]', 'baz'])
Exemplo n.º 28
0
 def test_no_commas(self):
     self.assertEqual(split_on_commas('foo'), ['foo'])
Exemplo n.º 29
0
 def test_end_bracket_in_value(self):
     self.assertEqual(split_on_commas('foo,bar=[foo,*[biz]*,baz]'),
                      ['foo', 'bar=foo,*[biz]*,baz'])
Exemplo n.º 30
0
 def test_escape_backslash(self):
     self.assertEqual(split_on_commas('foo,bar\\\\,baz\\\\,qux'),
                      ['foo', 'bar\\', 'baz\\', 'qux'])
Exemplo n.º 31
0
 def test_inner_quote_split(self):
     self.assertEqual(split_on_commas('foo,bar="1,2,3",baz'),
                      ['foo', 'bar=1,2,3', 'baz'])
Exemplo n.º 32
0
 def test_quoted_square_brackets(self):
     self.assertEqual(split_on_commas('foo,bar="[blah]",c=d],baz'),
                      ['foo', 'bar=[blah]', 'c=d]', 'baz'])
Exemplo n.º 33
0
 def test_normal_csv_split(self):
     self.assertEqual(split_on_commas('foo,bar,baz'), ['foo', 'bar', 'baz'])
Exemplo n.º 34
0
 def test_bracket_in_middle(self):
     self.assertEqual(split_on_commas('foo,bar=a[b][c],baz'),
                      ['foo', 'bar=a[b][c]', 'baz'])
Exemplo n.º 35
0
 def test_quote_split(self):
     self.assertEqual(split_on_commas('foo,"bar",baz'),
                      ['foo', 'bar', 'baz'])
Exemplo n.º 36
0
 def test_quote_split(self):
     self.assertEqual(split_on_commas('foo,"bar",baz'),
                      ['foo', 'bar', 'baz'])
Exemplo n.º 37
0
 def test_inner_quote_split(self):
     self.assertEqual(split_on_commas('foo,bar="1,2,3",baz'),
                      ['foo', 'bar=1,2,3', 'baz'])
Exemplo n.º 38
0
 def _split_on_commas(self, value):
     try:
         return utils.split_on_commas(value)
     except ValueError as e:
         raise ParamSyntaxError(str(e))
Exemplo n.º 39
0
 def test_single_quote(self):
     self.assertEqual(split_on_commas("foo,bar='1,2,3',baz"),
                      ['foo', 'bar=1,2,3', 'baz'])