(self)
| 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 | |
| 182 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected