def _pick_tests(tests, matrix): matrix = matrix or {} for test in tests: for params in utils.algebraic_product(**matrix): parametrized_test = copy.deepcopy(test) parametrized_test.update(params) parametrized_test['title'] = _make_test_title(test, params) yield parametrized_test
def test_algebraic_product_empty(self): expected = [{}] observed = list(utils.algebraic_product()) self.assertEqual(expected, observed)
def test_algebraic_product_number(self): expected = [{'a': 'x', 'b': 4}, {'a': 2, 'b': 4}] observed = list(utils.algebraic_product(a=['x', 2], b=4)) self.assertEqual(expected, observed)
def test_algebraic_product_string(self): expected = [{'a': 1, 'b': 'zebra'}, {'a': 2, 'b': 'zebra'}] observed = list(utils.algebraic_product(a=[1, 2], b='zebra')) self.assertEqual(expected, observed)