def test_update(): '''test the update function''' # do we really add nothing if add==False ? d = poheader.update({}, test='hello') assert len(d) == 0 # do we add if add==True ? d = poheader.update({}, add=True, Test='hello') assert len(d) == 1 assert d['Test'] == 'hello' # do we really update ? d = poheader.update({'Test': 'hello'}, add=True, Test='World') assert len(d) == 1 assert d['Test'] == 'World' # does key rewrite work ? d = poheader.update({}, add=True, test_me='hello') assert d['Test-Me'] == 'hello' # is the order correct ? d = ordereddict() d['Project-Id-Version'] = 'abc' d['POT-Creation-Date'] = 'now' d = poheader.update(d, add=True, Test='hello', Report_Msgid_Bugs_To='*****@*****.**') assert d.keys()[0] == "Project-Id-Version" assert d.keys()[1] == "Report-Msgid-Bugs-To" assert d.keys()[2] == "POT-Creation-Date" assert d.keys()[3] == "Test"
def test_update(): """test the update function""" # do we really add nothing if add==False ? d = poheader.update({}, test="hello") assert len(d) == 0 # do we add if add==True ? d = poheader.update({}, add=True, Test="hello") assert len(d) == 1 assert d["Test"] == "hello" # do we really update ? d = poheader.update({"Test": "hello"}, add=True, Test="World") assert len(d) == 1 assert d["Test"] == "World" # does key rewrite work ? d = poheader.update({}, add=True, test_me="hello") assert d["Test-Me"] == "hello" # is the order correct ? d = OrderedDict() d["Project-Id-Version"] = "abc" d["POT-Creation-Date"] = "now" d = poheader.update(d, add=True, Test="hello", Report_Msgid_Bugs_To="*****@*****.**") assert list(d.keys()) == [ "Project-Id-Version", "Report-Msgid-Bugs-To", "POT-Creation-Date", "Test", ]
def test_update(): """test the update function""" # do we really add nothing if add==False ? d = poheader.update({}, test="hello") assert len(d) == 0 # do we add if add==True ? d = poheader.update({}, add=True, Test="hello") assert len(d) == 1 assert d["Test"] == "hello" # do we really update ? d = poheader.update({"Test": "hello"}, add=True, Test="World") assert len(d) == 1 assert d["Test"] == "World" # does key rewrite work ? d = poheader.update({}, add=True, test_me="hello") assert d["Test-Me"] == "hello" # is the order correct ? d = OrderedDict() d["Project-Id-Version"] = "abc" d["POT-Creation-Date"] = "now" d = poheader.update(d, add=True, Test="hello", Report_Msgid_Bugs_To="*****@*****.**") assert d.keys()[0] == "Project-Id-Version" assert d.keys()[1] == "Report-Msgid-Bugs-To" assert d.keys()[2] == "POT-Creation-Date" assert d.keys()[3] == "Test"