示例#1
0
    def test_create_should_return_a_result_with_a_parsed_node(
            self, report, pattern_config):
        result = Result.create(report, pattern_config)

        assert isinstance(result, Result)
        assert result.outcome == report.outcome
        assert result.node == Node.parse(report.nodeid, pattern_config)
示例#2
0
    def test_parse_should_parse_node_id_attributes(self, pattern_config):
        nodeid = 'tests/test_module.py::test_title'
        node = Node.parse(nodeid, pattern_config)

        assert node.title == formatters.format_title('test_title',
                                                     pattern_config.functions)
        assert node.module_name == (formatters.format_module_name(
            'tests/test_module.py', pattern_config.files))
示例#3
0
    def test_parse_should_use_overridden_attribute_instead_of_parse_node_id(
            self, attribute, value, pattern_config):
        nodeid = 'tests/test_module.py::test_title'

        node = Node.parse(nodeid, pattern_config, **{attribute: value})

        result = getattr(node, attribute)

        assert result == formatters.format_multi_line_text(value)
示例#4
0
    def test_create_should_call_parse_with_overridden_attributes(
            self, report_attribute, parameter, value, report, pattern_config):
        setattr(report, report_attribute, value)

        result = Result.create(report, pattern_config)

        kwargs = {parameter: value}

        assert result.node == Node.parse(nodeid=report.nodeid,
                                         pattern_config=pattern_config,
                                         **kwargs)
示例#5
0
    def test_should_be_equal_when_objects_have_the_same_attributes(self, node):
        other = Node(title=node.title,
                     class_name=node.class_name,
                     module_name=node.module_name)

        assert node == other
示例#6
0
    def test_parse_with_class_name(self, pattern_config, nodeid, class_name):
        node = Node.parse(nodeid, pattern_config)

        assert node.class_name == class_name
示例#7
0
    def test_parse_should_return_a_node_instance(self, pattern_config):
        nodeid = 'tests/test_module.py::test_title'
        node = Node.parse(nodeid, pattern_config)

        assert isinstance(node, Node)
示例#8
0
def node():
    return Node(title='title', class_name='class_name', module_name='module')