| 226 | @testing.requires.cextensions |
| 227 | @testing.variation(class="st">"direction", [class="st">"py_to_cy", class="st">"cy_to_py"]) |
| 228 | def test_serialize_cy_py_cy( |
| 229 | self, direction: testing.Variation, _load_module |
| 230 | ): |
| 231 | _cy_row, _py_row = _load_module |
| 232 | |
| 233 | global Row |
| 234 | |
| 235 | p = result.SimpleResultMetaData([class="st">"a", class="st">"w", class="st">"b"]) |
| 236 | |
| 237 | if direction.py_to_cy: |
| 238 | dump_cls = _py_row.BaseRow |
| 239 | load_cls = _cy_row.BaseRow |
| 240 | elif direction.cy_to_py: |
| 241 | dump_cls = _cy_row.BaseRow |
| 242 | load_cls = _py_row.BaseRow |
| 243 | else: |
| 244 | direction.fail() |
| 245 | |
| 246 | for loads, dumps in picklers(): |
| 247 | |
| 248 | class Row(dump_cls): |
| 249 | pass |
| 250 | |
| 251 | row = Row(p, p._processors, p._key_to_index, (1, 2, 3)) |
| 252 | |
| 253 | state = dumps(row) |
| 254 | |
| 255 | class Row(load_cls): |
| 256 | pass |
| 257 | |
| 258 | row2 = loads(state) |
| 259 | is_true(isinstance(row2, load_cls)) |
| 260 | is_false(isinstance(row2, dump_cls)) |
| 261 | state2 = dumps(row2) |
| 262 | |
| 263 | class Row(dump_cls): |
| 264 | pass |
| 265 | |
| 266 | row3 = loads(state2) |
| 267 | is_true(isinstance(row3, dump_cls)) |
| 268 | |
| 269 | def test_processors(self): |
| 270 | parent = result.SimpleResultMetaData([class="st">"a", class="st">"b", class="st">"c", class="st">"d"]) |