test.mock.call

Here are the examples of the python api test.mock.call taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: fuddly Source File: test_data_model_helpers.py
    def assert_regex_is_valid(self, test_case):

        charset = test_case['charset'] if 'charset' in test_case else MH.Charset.ASCII_EXT
        self._parser.parse(test_case['regex'], "name", charset)


        calls = []
        nodes = test_case['nodes']
        for i in range(0, len(nodes)):

            type = nodes[i]['type'] if 'type' in nodes[i] else vt.String
            values = nodes[i]['values'] if 'values' in nodes[i] else None
            alphabet = nodes[i]['alphabet'] if 'alphabet' in nodes[i] else None
            qty = nodes[i]['qty'] if 'qty' in nodes[i] else (1, 1)

            calls.append(mock.call("name" + "_" + str(i + 1), type, values=values, alphabet=alphabet, qty=qty))

        self._parser._create_terminal_node.assert_has_calls(calls)

        self.assertEquals(self._parser._create_terminal_node.call_count, len(test_case['nodes']))