Ejemplo n.º 1
0
 def test_kval_custom_spaced(self):
     """Test key:val csv parsing with excess outer/value whitespace, and custom split characters."""
     self.assertListEqual(
         helpers.parse_keyval('  John  |   Doe ;  Jane  |Smith  ',
                              valsplit='|',
                              csvsplit=';'), [('John', 'Doe'),
                                              ('Jane', 'Smith')])
Ejemplo n.º 2
0
 def test_kval_custom_clean(self):
     """
     Test that a clean key:val csv with custom split characters is parsed correctly
     (pipe for kv, semi-colon for pair separation)
     """
     self.assertListEqual(
         helpers.parse_keyval('John|Doe;Jane|Smith', valsplit='|', csvsplit=';'),
         [('John', 'Doe'), ('Jane', 'Smith')]
     )
Ejemplo n.º 3
0
 def test_kval_single(self):
     """Test that a single value still returns a list"""
     self.assertListEqual(
         helpers.parse_keyval('John:Doe'),
         [('John', 'Doe')]
     )
Ejemplo n.º 4
0
 def test_kval_spaced(self):
     """Test key:val csv parsing with excess outer whitespace, and value whitespace"""
     self.assertListEqual(
         helpers.parse_keyval(' John  : Doe  , Jane :  Smith '),
         [('John', 'Doe'), ('Jane', 'Smith')]
     )
Ejemplo n.º 5
0
 def test_kval_clean(self):
     """Test that a clean key:val csv is parsed correctly"""
     self.assertListEqual(
         helpers.parse_keyval('John:Doe,Jane:Smith'),
         [('John', 'Doe'), ('Jane', 'Smith')]
     )