Tests that freezing a policy applies default values.
(self)
| 28 | class ShardingTest(test.TestCase): |
| 29 | |
| 30 | def testFreeze(self): |
| 31 | """Tests that freezing a policy applies default values.""" |
| 32 | p1 = tpu_sharding.ShardingPolicy() |
| 33 | p1.freeze() |
| 34 | self.assertEqual(p1.number_of_shards, |
| 35 | tpu_sharding._DEFAULT_NUMBER_OF_SHARDS) |
| 36 | self.assertEqual(p1.shard_dimension, tpu_sharding._DEFAULT_SHARD_DIMENSION) |
| 37 | p2 = tpu_sharding.ShardingPolicy() |
| 38 | p2.set_number_of_shards(17) |
| 39 | p2.set_shard_dimension(23) |
| 40 | p2.freeze() |
| 41 | self.assertEqual(p2.number_of_shards, 17) |
| 42 | self.assertEqual(p2.shard_dimension, 23) |
| 43 | |
| 44 | def testFrozen(self): |
| 45 | """Tests that frozen policies can't be changed.""" |
nothing calls this directly
no test coverage detected