示例#1
0
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
示例#2
0
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
示例#3
0
    def test_algebraic_product_empty(self):
        expected = [{}]

        observed = list(utils.algebraic_product())

        self.assertEqual(expected, observed)
示例#4
0
    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)
示例#5
0
    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)
示例#6
0
    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)
示例#7
0
    def test_algebraic_product_empty(self):
        expected = [{}]

        observed = list(utils.algebraic_product())

        self.assertEqual(expected, observed)
示例#8
0
    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)