dd6afb2e51df558f103ba8b3e11a3871b2015962,src/python/pants/backend/project_info/source_file_validator_test.py,MultiMatcherTest,setUp,#MultiMatcherTest#,32

Before Change


class MultiMatcherTest(unittest.TestCase):
    def setUp(self):
        config = {
            "path_patterns": {
                "python_src": {"pattern": r"\.py$"},
                "java_src": {"pattern": r"\.java$"},
                "scala_src": {"pattern": r"\.scala$"},
                "multi_encodings1": {"pattern": r"\.foo$", "content_encoding": "ascii"},
                "multi_encodings2": {"pattern": r"\.foo$"},
            },
            "content_patterns": {
                "python_header": {
                    "pattern": textwrap.dedent(

After Change


class MultiMatcherTest(unittest.TestCase):
    def setUp(self):
        config = {
            "path_patterns": [
                {"name": "python_src", "pattern": r"\.py$"},
                {"name": "java_src", "pattern": r"\.java$"},
                {"name": "scala_src", "pattern": r"\.scala$"},
                {"name": "multi_encodings1", "pattern": r"\.foo$", "content_encoding": "ascii"},
                {"name": "multi_encodings2", "pattern": r"\.foo$"},
            ],
            "content_patterns": [
                {
                    "name": "python_header",
                    "pattern": textwrap.dedent(
                        r
                        ^// coding=utf-8
                        // Copyright 20\d\d Pants project contributors \(see CONTRIBUTORS.md\)\.
                        // Licensed under the Apache License, Version 2\.0 \(see LICENSE\)\.

                        from __future__ import absolute_import, division, print_function, unicode_literals
                        
                    ).lstrip(),
                },
                {
                    "name": "no_six",
                    "pattern": r"(?m)(^from six(\.\w+)* +import +)|(^import six\s*$)",
                    "inverted": True,
                },
                {
                    "name": "jvm_header",
                    "pattern": textwrap.dedent(
                        r
                        // Copyright 20\d\d Pants project contributors (see CONTRIBUTORS.md).
                        // Licensed under the Apache License, Version 2.0 (see LICENSE).
                        
                    ).lstrip(),
                },
                {"name": "dummy", "pattern": "dummy"},
            ],
            "required_matches": {
                "python_src": ("python_header", "no_six"),
                "java_src": ("jvm_header",),
                "scala_src": ("jvm_header",),
                "multi_encodings1": ("dummy",),
                "multi_encodings2": ("dummy",),
            },
        }
        self._rm = MultiMatcher(ValidationConfig.from_dict(config))

    def test_get_applicable_content_pattern_names(self):
        def check(expected_content_pattern_names, expected_encoding, path):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: pantsbuild/pants
Commit Name: dd6afb2e51df558f103ba8b3e11a3871b2015962
Time: 2020-07-15
Author: benjyw@gmail.com
File Name: src/python/pants/backend/project_info/source_file_validator_test.py
Class Name: MultiMatcherTest
Method Name: setUp


Project Name: pantsbuild/pants
Commit Name: dd6afb2e51df558f103ba8b3e11a3871b2015962
Time: 2020-07-15
Author: benjyw@gmail.com
File Name: src/python/pants/backend/project_info/source_file_validator_test.py
Class Name: MultiMatcherTest
Method Name: test_pattern_name_checks


Project Name: sebp/scikit-survival
Commit Name: 68f643e33211f4bb2b37ca0d14c1e3762e150713
Time: 2018-07-10
Author: sebp@k-d-w.org
File Name: tests/test_column.py
Class Name: TestEncodeCategorical
Method Name: test_case1