def test_filter_single_subset_exclude(self): exps = [(None, ['sample2']), ("Study='A'", ['sample2']), ("Study='A' OR Study='B'", ['sample2'])] for (where, exp) in exps: dir_fmt = filter_samples(self.sample_single, self.md_single_subset, where, True) self._assert_single_contains(dir_fmt, exp)
def test_filter_paired_subset(self): exps = [(None, ['sample1R1', 'sample1R2']), ("Study='A'", ['sample1R1', 'sample1R2']), ("Study='A' OR Study='B'", ['sample1R1', 'sample1R2'])] for (where, exp) in exps: dir_fmt = filter_samples(self.sample_paired, self.md_paired_subset, where, False) self._assert_paired_contains(dir_fmt, exp)
def test_filter_single_all(self): exps = [(None, ['sample1', 'sample2']), ("Study='A'", ['sample1']), ("Study='B'", ['sample2']), ("Study='A' OR Study='B'", ['sample1', 'sample2'])] for (where, exp) in exps: dir_fmt = filter_samples(self.sample_single, self.md_single_all, where, False) self._assert_single_contains(dir_fmt, exp)
def test_filter_paired_all_exclude(self): exps = [(None, []), ("Study='A'", ['sample2R1', 'sample2R2']), ("Study='B'", ['sample1R1', 'sample1R2']), ("Study='A' OR Study='B'", [])] for (where, exp) in exps: dir_fmt = filter_samples(self.sample_paired, self.md_paired_all, where, True) self._assert_paired_contains(dir_fmt, exp)
def test_filter_single_subset_no_filter(self): wheres = ["Study='B'", "Study='A' AND Study='B'"] for where in wheres: with self.assertRaisesRegex(ValueError, 'No'): filter_samples(self.sample_single, self.md_single_subset, where, False)
def test_filter_paired_none_exclude_no_filter(self): wheres = ["Study='B'", "Study='A' AND Study='B'"] for where in wheres: with self.assertRaisesRegex(ValueError, 'No'): filter_samples(self.sample_paired, self.md_paired_none, where, True)
def test_filter_paired_id_not_present(self): wheres = [None, "Study='A'", "Study='A' OR Study='B'"] for where in wheres: with self.assertRaisesRegex(ValueError, '1'): filter_samples(self.sample_paired, self.md_paired_none, where, False)