def test_generate_subsamples(self): table = Table(np.array([[3, 1, 1], [0, 3, 3]]), ["O1", "O2"], ["S1", "S2", "S3"]) actual_o1 = set() actual_o2 = set() for i, obs in zip(range(100), generate_subsamples(table, 3)): actual_o1.add(tuple(obs.data("O1", "observation"))) actual_o2.add(tuple(obs.data("O2", "observation"))) self.assertEqual(actual_o1, {(3, 0, 0), (3, 1, 0), (3, 0, 1), (3, 1, 1)}) self.assertEqual(actual_o2, {(0, 3, 3), (0, 2, 3), (0, 3, 2), (0, 2, 2)})
def test_generate_subsamples(self): table = Table(np.array([[3, 1, 1], [0, 3, 3]]), ['O1', 'O2'], ['S1', 'S2', 'S3']) actual_o1 = set() actual_o2 = set() for i, obs in zip(range(100), generate_subsamples(table, 3)): actual_o1.add(tuple(obs.data('O1', 'observation'))) actual_o2.add(tuple(obs.data('O2', 'observation'))) self.assertEqual(actual_o1, {(3, 0, 0), (3, 1, 0), (3, 0, 1), (3, 1, 1)}) self.assertEqual(actual_o2, {(0, 3, 3), (0, 2, 3), (0, 3, 2), (0, 2, 2)})