def write_files(self): the_file_xdict = XDict(self.file_dictionary) for filepath, file_string in the_file_xdict.xitems(): fw = nfile.FileWriter(filepath) try: fw.write_utf8(file_string) except TypeError as te: # catch unicode write errors fw.write(file_string)
def test_xdict_xitems(self): xd = XDict( { 'a_one': 'value_one', 'b_two': 'value_two', 'c_three': 'value_three' }, {'attrkey': 'attrval'}) for keys, values in xd.xitems(): self.assertTrue('a_one' in keys or 'b_two' in keys or 'c_three' in keys) self.assertTrue('value_one' in values or 'value_two' in values or 'value_three' in values)
def test_xdict_xitems(self): xd = XDict({'a_one': 'value_one', 'b_two': 'value_two', 'c_three': 'value_three'}, {'attrkey': 'attrval'}) for keys, values in xd.xitems(): self.assertTrue('a_one' in keys or 'b_two' in keys or 'c_three' in keys) self.assertTrue('value_one' in values or 'value_two' in values or 'value_three' in values)