Exemplo n.º 1
0
    def test_get_category_value_to_sample_ids(self):
        """get_category_value_to_sample_ids functions as expected
        """
        test_data = get_test_data()
        actual = get_category_value_to_sample_ids(test_data['map'],
                                                  'SampleType')
        expected = {
            'feces': ['f1', 'f2', 'f3', 'f4', 'f5', 'f6'],
            'L_palm': ['p1', 'p2'],
            'Tongue': ['t1', 't2'],
            'Other': ['not16S.1']
        }
        self.assertEqual(actual, expected)

        actual = get_category_value_to_sample_ids(test_data['map'], 'year')
        expected = {
            '2008': [
                'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'p1', 'p2', 't1', 't2',
                'not16S.1'
            ]
        }
        self.assertEqual(actual, expected)

        self.assertRaises(ValueError, get_category_value_to_sample_ids,
                          test_data['map'], 'not.a.real.category')
Exemplo n.º 2
0
 def test_get_category_value_to_sample_ids(self):
     """get_category_value_to_sample_ids functions as expected
     """
     test_data = get_test_data()
     actual = get_category_value_to_sample_ids(test_data['map'],'SampleType')
     expected = {'feces':['f1','f2','f3','f4','f5','f6'],
                 'L_palm':['p1','p2'],
                 'Tongue':['t1','t2'],
                 'Other':['not16S.1']}
     self.assertEqual(actual,expected)
     
     actual = get_category_value_to_sample_ids(test_data['map'],'year')
     expected = {'2008':['f1','f2','f3','f4','f5','f6',
                          'p1','p2','t1','t2','not16S.1']}
     self.assertEqual(actual,expected)
     
     self.assertRaises(ValueError,
                       get_category_value_to_sample_ids,
                       test_data['map'],
                       'not.a.real.category')