MCPcopy Create free account
hub / github.com/STIXProject/python-stix / test_utf16_roundtrip

Method test_utf16_roundtrip

stix/test/encoding_test.py:165–179  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

163
164 @silence_warnings
165 def test_utf16_roundtrip(self):
166 sh = STIXHeader()
167 sh.title = UNICODE_STR
168 sp = STIXPackage()
169 sp.stix_header = sh
170
171 # serialize as utf-16
172 xml16 = sp.to_xml(encoding='utf-16')
173
174 # deserialize as utf-16
175 sp2 = STIXPackage.from_xml(BytesIO(xml16), encoding='utf-16')
176 sh2 = sp2.stix_header
177
178 # check that the titles align
179 self.assertEqual(sh.title, sh2.title)
180
181
182if __name__ == "__main__":

Callers

nothing calls this directly

Calls 4

STIXHeaderClass · 0.90
STIXPackageClass · 0.90
from_xmlMethod · 0.80
to_xmlMethod · 0.45

Tested by

no test coverage detected