def testUTF8Japanese(self): fh = StringIO("""OFXHEADER:100 DATA:OFXSGML VERSION:102 SECURITY:NONE ENCODING:UTF-8 CHARSET:CSUNICODE COMPRESSION:NONE OLDFILEUID:NONE NEWFILEUID:NONE """) ofx_file = OfxFile(fh) headers = ofx_file.headers result = ofx_file.fh.read() self.assertTrue(type(result) is unicode) for key, value in headers.iteritems(): self.assertTrue(type(key) is unicode) self.assertTrue(type(value) is not str)
def testUTF8Japanese(self): fh = six.BytesIO(six.b("""OFXHEADER:100 DATA:OFXSGML VERSION:102 SECURITY:NONE ENCODING:UTF-8 CHARSET:CSUNICODE COMPRESSION:NONE OLDFILEUID:NONE NEWFILEUID:NONE """)) ofx_file = OfxFile(fh) headers = ofx_file.headers result = ofx_file.fh.read() self.assertTrue(type(result) is six.text_type) for key, value in six.iteritems(headers): self.assertTrue(type(key) is six.text_type) self.assertTrue(type(value) is not six.binary_type)
def testBrokenLineEndings(self): fh = six.BytesIO(six.b("OFXHEADER:100\rDATA:OFXSGML\r")) ofx_file = OfxFile(fh) self.assertEquals(len(ofx_file.headers.keys()), 2)