def test_partition_long_chain_parse(self): blockade_id = "abc123awhopbopaloobopalopbamboom" self.assertEqual("blockade-abc123awhopbopal-p1", partition_chain_name(blockade_id, 1)) self.assertEqual("blockade-abc123awhopbopal-p2", partition_chain_name(blockade_id, 2)) index = parse_partition_index(blockade_id, partition_chain_name(blockade_id, 1)) self.assertEqual(1, index) with self.assertRaises(ValueError): parse_partition_index(blockade_id, "abc123")
def test_partition_long_chain_parse(self): blockade_id = "abc123awhopbopaloobopalopbamboom" self.assertEqual( "blockade-abc123awhopbopal-p1", partition_chain_name(blockade_id, 1) ) self.assertEqual( "blockade-abc123awhopbopal-p2", partition_chain_name(blockade_id, 2) ) index = parse_partition_index(blockade_id, partition_chain_name(blockade_id, 1)) self.assertEqual(1, index) with self.assertRaises(ValueError): parse_partition_index(blockade_id, "abc123")
def test_partition_chain_parse(self): blockade_id = "abc123" self.assertEqual(partition_chain_name(blockade_id, 1), "abc123-p1") self.assertEqual(partition_chain_name(blockade_id, 2), "abc123-p2") index = parse_partition_index(blockade_id, partition_chain_name(blockade_id, 1)) self.assertEqual(index, 1) with self.assertRaises(ValueError): parse_partition_index(blockade_id, "notablockade") with self.assertRaises(ValueError): parse_partition_index(blockade_id, "abc123-1") with self.assertRaises(ValueError): parse_partition_index(blockade_id, "abc123-p") with self.assertRaises(ValueError): parse_partition_index(blockade_id, "abc123-notanumber")