@@ -248,3 +248,50 @@ def test_insufficient_end_markers():
248248
249249 with pytest .raises (NotEnoughEndMarkers ):
250250 parse (iem_fields )
251+
252+
253+ def test_bare_with_marker (fields ):
254+ from peppercorn import parse
255+
256+ i = 0
257+ def next_id ():
258+ nonlocal i
259+ i += 1
260+ return str (i )
261+
262+ fields_with_marker = [
263+ (key + ":" + next_id (), value )
264+ for key , value in fields
265+ ]
266+
267+ result = parse (fields_with_marker , unique_key_separator = ":" )
268+
269+ _assertFieldsResult (result )
270+
271+
272+ def test_bare_without_marker (fields ):
273+ # This is proof that ":" isn't something special when we don't
274+ # provide a unique key separator
275+ from peppercorn import START , END
276+ from peppercorn import parse
277+
278+ fields_wo_marker = []
279+
280+ for key , value in fields :
281+ if key not in [START , END ]:
282+ key = key + ":something"
283+ fields .append ((key , value ))
284+
285+ result = self ._callFUT (fields_wo_marker )
286+
287+ assert result == {
288+ 'series' : {
289+ 'name:something' :'date series 1' ,
290+ 'dates' : [
291+ ['10' , '12' , '2008' ],
292+ ['10' , '12' , '2009' ],
293+ ],
294+ },
295+ 'name:something' : 'project1' ,
296+ 'title:something' : 'Cool project' ,
297+ }
0 commit comments