def test_map_sample_ids(self): """Mapping and reordering of sample IDs functions as expected """ expected = ["s4", "s1", "s2", "s3"] actual = map_sample_ids(self.sample_ids1, self.sample_id_map1) self.assertEqual(actual, expected) expected = ["s1", "s2", "s3", "s4"] actual = map_sample_ids(self.sample_ids2, self.sample_id_map1) self.assertEqual(actual, expected) expected = ["s1", "s2", "s3", "s4"] actual = map_sample_ids(self.sample_ids3, self.sample_id_map1) self.assertEqual(actual, expected) # bad sample id raises KeyError self.assertRaises(KeyError, map_sample_ids, ["abcd", "aaa", "ccc"], self.sample_id_map1)
def test_map_sample_ids(self): """Mapping and reordering of sample IDs functions as expected """ expected = ['s4', 's1', 's2', 's3'] actual = map_sample_ids(self.sample_ids1, self.sample_id_map1) self.assertEqual(actual, expected) expected = ['s1', 's2', 's3', 's4'] actual = map_sample_ids(self.sample_ids2, self.sample_id_map1) self.assertEqual(actual, expected) expected = ['s1', 's2', 's3', 's4'] actual = map_sample_ids(self.sample_ids3, self.sample_id_map1) self.assertEqual(actual, expected) # bad sample id raises KeyError self.assertRaises(KeyError, map_sample_ids, ['abcd', 'aaa', 'ccc'], self.sample_id_map1)