(states, hash_to_blob_map)
| 48 | return states, hash_to_blob_map |
| 49 | |
| 50 | def deserialize(states, hash_to_blob_map): |
| 51 | global arrayF32Id, arrayUI32Id |
| 52 | |
| 53 | if not len(states): |
| 54 | return |
| 55 | |
| 56 | manager = vtkObjectManager() |
| 57 | if not manager.Initialize(): |
| 58 | return |
| 59 | |
| 60 | for state in states: |
| 61 | manager.RegisterState(state) |
| 62 | for hash_text, blob in hash_to_blob_map.items(): |
| 63 | manager.RegisterBlob(hash_text, blob) |
| 64 | |
| 65 | manager.UpdateObjectsFromStates() |
| 66 | active_ids = manager.GetAllDependencies(0) |
| 67 | |
| 68 | self.assertEqual(len(active_ids), 2) |
| 69 | self.assertEqual(arrayF32Id in active_ids, True) |
| 70 | self.assertEqual(arrayUI32Id in active_ids, True) |
| 71 | |
| 72 | arrayF32 = manager.GetObjectAtId(arrayF32Id) |
| 73 | self.assertIsInstance(arrayF32, vtkTypeFloat32Array) |
| 74 | |
| 75 | arrayUI32 = manager.GetObjectAtId(arrayUI32Id) |
| 76 | self.assertIsInstance(arrayUI32, vtkUnsignedIntArray) |
| 77 | |
| 78 | for i in range(10): |
| 79 | self.assertEqual(10 - i, arrayF32.GetValue(i)) |
| 80 | self.assertEqual(20 + i, arrayUI32.GetValue(i)) |
| 81 | |
| 82 | |
| 83 | deserialize(*serialize()) |
nothing calls this directly
no test coverage detected