def test_paired_subsample_undefined(self):
     known_array = np.zeros((2, 0))
     cat = 'INT'
     order = ['Y', 'N']
     control_cats = ['AGE', 'ABX', 'SEX']
     test_array = paired_subsamples(self.meta, cat, control_cats,
                                    order=order)
     npt.assert_array_equal(test_array, known_array)
 def test_paired_subsamples_break(self):
     # Sets known np.array set
     known_array = [np.array([]), np.array([])]
     # Gets the test value
     cat = 'ABX'
     control_cats = ['SEX', 'AGE', 'INT']
     test_array = paired_subsamples(self.meta, cat, control_cats)
     npt.assert_array_equal(known_array, test_array)
    def test_paired_subsamples_not_strict(self):
        known_array = [{'WM', 'MM', 'GW', 'SR', 'TS'},
                       {'LF', 'PC', 'CB', 'NR', 'CD'}]

        # Gets the test values
        cat = 'INT'
        control_cats = ['ABX', 'AGE']
        test_array = paired_subsamples(self.meta, cat, control_cats,
                                       strict_match=False)
        self.assertEqual(set(test_array[0]), known_array[0])
        self.assertEqual(set(test_array[1]), known_array[1])
    def test_paired_subsamples_default(self):
        # Sets the known np.array set
        known_array = [{'MM', 'SR', 'TS', 'GW', 'PP', 'WM'},
                       {'CD', 'LF', 'PC', 'CB', 'MH', 'NR'}]

        # Gets the test value
        cat = 'INT'
        control_cats = ['SEX', 'AGE']
        test_array = paired_subsamples(self.meta, cat, control_cats)
        self.assertEqual(known_array[0], set(test_array[0]))
        self.assertEqual(known_array[1], set(test_array[1]))
Exemple #5
0
    def test_paired_subsamples_not_strict(self):
        known_array = [sorted(['WM', 'MM', 'GW', 'SR', 'TS']),
                       sorted(['LF', 'PC', 'CB', 'NR', 'CD'])]

        # Gets the test values
        cat = 'INT'
        control_cats = ['ABX', 'AGE']
        test_array = paired_subsamples(self.meta, cat, control_cats,
                                       strict_match=False)
        test_array[0] = sorted(test_array[0])
        test_array[1] = sorted(test_array[1])
        npt.assert_array_equal(known_array, test_array)
Exemple #6
0
    def test_paired_subsamples_default(self):
        # Sets the known np.array set
        known_array = [sorted(['MM', 'SR', 'TS', 'GW', 'PP', 'WM']),
                       sorted(['CD', 'LF', 'PC', 'CB', 'MH', 'NR'])]

        # Gets the test value
        cat = 'INT'
        control_cats = ['SEX', 'AGE']
        test_array = paired_subsamples(self.meta, cat, control_cats)
        test_array[0] = sorted(test_array[0])
        test_array[1] = sorted(test_array[1])
        npt.assert_array_equal(known_array, test_array)
 def test_paired_subsample_fewer(self):
     # Set known value
     known_array = {'PP', 'MH', 'CD', 'PC', 'TS', 'MM'}
     # Sets up test values
     cat = 'AGE'
     order = ['30s', '40s']
     control_cats = ['ABX']
     test_array = paired_subsamples(self.meta, cat, control_cats,
                                    order=order)
     for v in test_array[0]:
         self.assertTrue(v in known_array)
     for v in test_array[1]:
         self.assertTrue(v in known_array)