def _doDuplicateRoundtrip(caldata): cal = Calendar() cal.parse(StringIO.StringIO(caldata)) cal = cal.duplicate() s = StringIO.StringIO() cal.generate(s) self.assertEqual(caldata, s.getvalue())
def _doRoundtrip(caldata, resultdata=None): test1 = resultdata if resultdata is not None else caldata cal = Calendar() cal.parse(StringIO.StringIO(caldata)) s = StringIO.StringIO() cal.generate(s) test2 = s.getvalue() self.assertEqual( test1, test2, "\n".join( difflib.unified_diff( str(test1).splitlines(), test2.splitlines())))
def _doRoundtrip(caldata, resultdata=None): test1 = resultdata if resultdata is not None else caldata cal = Calendar() cal.parse(StringIO.StringIO(caldata)) s = StringIO.StringIO() cal.generate(s) test2 = s.getvalue() self.assertEqual( test1, test2, "\n".join(difflib.unified_diff(str(test1).splitlines(), test2.splitlines())) )