Tests if the class is able to generate serialized strings.
(self)
| 26 | class TopologyTest(test.TestCase): |
| 27 | |
| 28 | def testSerialization(self): |
| 29 | """Tests if the class is able to generate serialized strings.""" |
| 30 | original_topology = topology.Topology( |
| 31 | mesh_shape=[1, 1, 2], |
| 32 | device_coordinates=[[[0, 0, 0], [0, 0, 1]]], |
| 33 | ) |
| 34 | serialized_str = original_topology.serialized() |
| 35 | new_topology = topology.Topology(serialized=serialized_str) |
| 36 | |
| 37 | # Make sure the topology recovered from serialized str is same as the |
| 38 | # original topology. |
| 39 | self.assertAllEqual( |
| 40 | original_topology.mesh_shape, new_topology.mesh_shape) |
| 41 | self.assertAllEqual( |
| 42 | original_topology.device_coordinates, new_topology.device_coordinates) |
| 43 | |
| 44 | if __name__ == "__main__": |
| 45 | test.main() |
nothing calls this directly
no test coverage detected