Beispiel #1
0
    def test_sample_mapped_keys(self):
        """sample_mapped_keys retuns a dictionary of subsamples."""

        # With num_coverage=1 only the keys will be sampled
        actual = sample_mapped_keys(self.test_map, 1)
        self.assertEqual(actual, {'1': ['1'], '2': ['2']})

        actual = sample_mapped_keys(self.test_map, 3)
        for key in actual.keys():
           # check number of sampled keys
            self.assertEqual(3, len(actual[key]))
            for x in actual[key]:
               # check that sampled key is in the full list
                correct = list(self.test_map[key])
                correct.append(key)
                self.assertTrue(x in correct)
Beispiel #2
0
    def test_sample_mapped_keys(self):
        """sample_mapped_keys retuns a dictionary of subsamples."""

        # With num_coverage=1 only the keys will be sampled
        actual = sample_mapped_keys(self.test_map, 1)
        self.assertEqual(actual, {'1': ['1'], '2': ['2']})

        actual = sample_mapped_keys(self.test_map, 3)
        for key in actual.keys():
            #check number of sampled keys
            self.assertEqual(3, len(actual[key]))
            for x in actual[key]:
                #check that sampled key is in the full list
                correct = list(self.test_map[key])
                correct.append(key)
                self.assertContains(correct, x)