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')])
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')] )
def test_kval_single(self): """Test that a single value still returns a list""" self.assertListEqual( helpers.parse_keyval('John:Doe'), [('John', 'Doe')] )
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')] )
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')] )