Example #1
0
    def test_flake8_extension_empty(self):
        python_string = self.get_ast_node("""
            """)

        linter = extension.Flake8Extension(python_string, "unused")

        result = list(linter.run())
        expected = []

        assert result == expected
Example #2
0
    def test_flake8_extension_basic(self):
        python_string = self.get_ast_node("""
            exec('print "TEST"')
            """)

        linter = extension.Flake8Extension(python_string, "unused")

        result = list(linter.run())
        expected = [
            (2, 0, extension.dlint.linters.BadExecUseLinter._error_tmpl,
             extension.dlint.linters.BadExecUseLinter)
        ]

        assert result == expected
Example #3
0
def test_benchmark_run(benchmark_py_file, benchmark):
    ext = extension.Flake8Extension(benchmark_py_file, "unused")

    benchmark(lambda: list(ext.run()))

    assert ext