Exemplo n.º 1
0
 def test_file(self):
     # Assert CSV file contents.
     v = self.csv
     v.save("test.csv", headers=True)
     v = open("test.csv", "rb").read()
     v = db.decode_utf8(v.lstrip(codecs.BOM_UTF8))
     v = v.replace("\r\n", "\n")
     self.assertEqual(v, 
         u'"name (STRING)","type (STRING)","tail (BOOLEAN)","age (INTEGER)","date (DATE)"\n'
         u'"Schrödinger","cat","True","3","2009-11-03 00:00:00"\n'
         u'"Hofstadter","labrador","True","5","2007-08-04 00:00:00"'
     )
     os.unlink("test.csv")
Exemplo n.º 2
0
 def test_decode_utf8(self):
     # Assert unicode.
     for s in self.strings:
         self.assertTrue(isinstance(db.decode_utf8(s), unicode))
     print "pattern.db.decode_utf8()"