def test_pretty_format_toml_autofix(tmpdir): run_autofix_test( tmpdir, pretty_format_toml, "not-pretty-formatted.toml", "not-pretty-formatted_fixed.toml", )
def test_ktlint_does_not_yet_support_java_16_or_more(tmpdir, undecorate_method): """ Test that running pretty-format-kotlin with Java 16+ is still not supported. The test is meant to be an early indicator that Java 16+ is now supported and as such `assert_max_jdk_version(...)` invocation can be removed from `pretty_format_kotlin.py` file """ with patch( "language_formatters_pre_commit_hooks.pretty_format_kotlin.assert_max_jdk_version", autospec=True, return_value=None, ), pytest.raises(UnexpectedStatusCode): run_autofix_test(tmpdir, undecorate_method, "not-pretty-formatted.kt", "not-pretty-formatted_fixed.kt")
def test_pretty_format_rust_autofix(tmpdir, undecorate_method): copyfile("not-pretty-formatted/Cargo.toml", tmpdir.join("Cargo.toml").strpath) run_autofix_test(tmpdir, undecorate_method, "not-pretty-formatted/src/main.rs", "not-pretty-formatted_fixed/src/main.rs")
def test_pretty_format_yaml_autofix(tmpdir, no_pretty_file_name, fixed_file_name): run_autofix_test(tmpdir, pretty_format_yaml, no_pretty_file_name, fixed_file_name)
def test_pretty_format_golang_autofix(tmpdir, undecorate_method): run_autofix_test(tmpdir, undecorate_method, "not-pretty-formatted.go", "not-pretty-formatted_fixed.go")
def test_pretty_format_java_autofix(tmpdir, undecorate_method): run_autofix_test(tmpdir, undecorate_method, "not-pretty-formatted.java", "not-pretty-formatted_fixed.java")
def test_pretty_format_kotlin_autofix(tmpdir, undecorate_method): run_autofix_test(tmpdir, undecorate_method, "not-pretty-formatted.kt", "not-pretty-formatted_fixed.kt")