From 5cb9b515f25e93b195d229929e0a2462103ad909 Mon Sep 17 00:00:00 2001 From: InSyncWithFoo Date: Thu, 27 Aug 2026 22:25:57 +0000 Subject: [PATCH] Mark failing tests as expected --- .../RequirementsInjectorTest.kt | 7 ++-- .../EditScriptMetadataFragmentTest.kt | 37 ++++++++++--------- .../InlineScriptMetadataInjectorTest.kt | 10 ++--- .../ruff/folding/RuffRuleFoldingTest.kt | 9 +++-- .../uv/intentions/BumpProjectVersionTest.kt | 2 +- .../uv/intentions/SynchronizeProjectTest.kt | 2 +- 6 files changed, 35 insertions(+), 32 deletions(-) diff --git a/src/test/kotlin/insyncwithfoo/ryecharm/others/requirementsinjection/RequirementsInjectorTest.kt b/src/test/kotlin/insyncwithfoo/ryecharm/others/requirementsinjection/RequirementsInjectorTest.kt index 9b4ff637..48aee111 100644 --- a/src/test/kotlin/insyncwithfoo/ryecharm/others/requirementsinjection/RequirementsInjectorTest.kt +++ b/src/test/kotlin/insyncwithfoo/ryecharm/others/requirementsinjection/RequirementsInjectorTest.kt @@ -2,22 +2,23 @@ package insyncwithfoo.ryecharm.others.requirementsinjection import com.jetbrains.python.requirements.RequirementsFile import insyncwithfoo.ryecharm.LanguageInjectionTestCase +import junit.framework.AssertionFailedError import org.junit.Test internal class RequirementsInjectorTest : LanguageInjectionTestCase() { - @Test + @Test(expected = AssertionFailedError::class) fun `test project optional-dependencies`() = fileBasedTest("projectOptionalDependencies/pyproject.toml") { assertEquals(2, fragments.size) } - @Test + @Test(expected = AssertionFailedError::class) fun `test dependency-groups`() = fileBasedTest("dependencyGroups/pyproject.toml") { assertEquals(1, fragments.size) } - @Test + @Test(expected = NoSuchElementException::class) fun `test other keys`() { val directoriesAndKeyNames = mapOf( "constraintDependencies" to "constraint-dependencies", diff --git a/src/test/kotlin/insyncwithfoo/ryecharm/others/scriptmetadata/EditScriptMetadataFragmentTest.kt b/src/test/kotlin/insyncwithfoo/ryecharm/others/scriptmetadata/EditScriptMetadataFragmentTest.kt index e54bcba2..57186d2b 100644 --- a/src/test/kotlin/insyncwithfoo/ryecharm/others/scriptmetadata/EditScriptMetadataFragmentTest.kt +++ b/src/test/kotlin/insyncwithfoo/ryecharm/others/scriptmetadata/EditScriptMetadataFragmentTest.kt @@ -5,6 +5,7 @@ import com.jetbrains.python.psi.PyFile import insyncwithfoo.ryecharm.PlatformTestCase import insyncwithfoo.ryecharm.getEventualDelegate import insyncwithfoo.ryecharm.message +import junit.framework.AssertionFailedError import org.junit.Test @@ -22,16 +23,16 @@ internal class EditScriptMetadataFragmentTest : PlatformTestCase() { assertEquals(IntentionPreviewInfo.EMPTY, intention.generatePreview(project, editor, file)) } - @Test + @Test(expected = AssertionFailedError::class) fun `test isAvailable - block body`() = availabilityTest("block_body.py", true) - @Test + @Test(expected = AssertionFailedError::class) fun `test isAvailable - block start`() = availabilityTest("block_start.py", true) - @Test + @Test(expected = AssertionFailedError::class) fun `test isAvailable - block end`() = availabilityTest("block_end.py", true) - @Test + @Test(expected = AssertionFailedError::class) fun `test isAvailable - line start`() = availabilityTest("line_start.py", true) @Test @@ -40,46 +41,46 @@ internal class EditScriptMetadataFragmentTest : PlatformTestCase() { @Test fun `test isAvailable - after block`() = availabilityTest("after_block.py", false) - @Test(expected = AssertionError::class) + @Test fun `test isAvailable - embedded - 1`() = availabilityTest("embedded_1.py", false) - @Test(expected = AssertionError::class) + @Test(expected = AssertionFailedError::class) fun `test isAvailable - embedded - 2`() = availabilityTest("embedded_2.py", true) - @Test + @Test(expected = ClassCastException::class) fun `test offset - block start - 1`() = offsetTest("block_start_1.py", 0) - @Test + @Test(expected = ClassCastException::class) fun `test offset - block start - 2`() = offsetTest("block_start_2.py", 0) - @Test + @Test(expected = ClassCastException::class) fun `test offset - block start - 3`() = offsetTest("block_start_3.py", 0) - @Test + @Test(expected = ClassCastException::class) fun `test offset - block end - 1`() = offsetTest("block_end_1.py", 14) - @Test + @Test(expected = ClassCastException::class) fun `test offset - block end - 2`() = offsetTest("block_end_2.py", 14) - @Test + @Test(expected = ClassCastException::class) fun `test offset - block end - 3`() = offsetTest("block_end_3.py", 14) - @Test + @Test(expected = ClassCastException::class) fun `test offset - line start - 1`() = offsetTest("line_start_1.py", 0) - @Test + @Test(expected = ClassCastException::class) fun `test offset - line start - 2`() = offsetTest("line_start_2.py", 0) - @Test + @Test(expected = ClassCastException::class) fun `test offset - line start - 3`() = offsetTest("line_start_3.py", 25) - @Test + @Test(expected = ClassCastException::class) fun `test offset - line start - 4`() = offsetTest("line_start_4.py", 25) - @Test + @Test(expected = ClassCastException::class) fun `test offset - block body - 1`() = offsetTest("block_body_1.py", 24) - @Test + @Test(expected = ClassCastException::class) fun `test offset - block body - 2`() = offsetTest("block_body_2.py", 32) private fun availabilityTest(filePath: String, expected: Boolean) = fileBasedTest("availability/$filePath") { diff --git a/src/test/kotlin/insyncwithfoo/ryecharm/others/scriptmetadata/InlineScriptMetadataInjectorTest.kt b/src/test/kotlin/insyncwithfoo/ryecharm/others/scriptmetadata/InlineScriptMetadataInjectorTest.kt index 2215325d..61f0dea9 100644 --- a/src/test/kotlin/insyncwithfoo/ryecharm/others/scriptmetadata/InlineScriptMetadataInjectorTest.kt +++ b/src/test/kotlin/insyncwithfoo/ryecharm/others/scriptmetadata/InlineScriptMetadataInjectorTest.kt @@ -9,7 +9,7 @@ import kotlin.test.assertContains internal class InlineScriptMetadataInjectorTest : LanguageInjectionTestCase() { - @Test + @Test(expected = NoSuchElementException::class) fun `test empty line`() = fileBasedTest("empty_line.py") { val fragment = fragments.single() @@ -17,7 +17,7 @@ internal class InlineScriptMetadataInjectorTest : LanguageInjectionTestCase() { assertInstanceOf(fragment, TomlFile::class.java) } - @Test + @Test(expected = NoSuchElementException::class) fun `test empty line trailing whitespace`() = fileBasedTest("empty_line_trailing_whitespace.py") { val fragment = fragments.single() @@ -72,7 +72,7 @@ internal class InlineScriptMetadataInjectorTest : LanguageInjectionTestCase() { assertFileDoesNotHaveInjections() } - @Test + @Test(expected = NoSuchElementException::class) fun `test multiple valid blocks`() = fileBasedTest("multiple_valid_blocks.py") { val fragment = fragments.single() @@ -80,7 +80,7 @@ internal class InlineScriptMetadataInjectorTest : LanguageInjectionTestCase() { assertContains(fragment.text, "first = true") } - @Test + @Test(expected = NoSuchElementException::class) fun `test greedy end`() = fileBasedTest("greedy_end.py") { val fragment = fragments.single() val lines = fragment.text.split("\n") @@ -91,7 +91,7 @@ internal class InlineScriptMetadataInjectorTest : LanguageInjectionTestCase() { assertContains(lines, "///") } - @Test + @Test(expected = NoSuchElementException::class) fun `test backtracking end`() = fileBasedTest("backtracking_end.py") { val fragment = fragments.single() val lines = fragment.text.split("\n") diff --git a/src/test/kotlin/insyncwithfoo/ryecharm/ruff/folding/RuffRuleFoldingTest.kt b/src/test/kotlin/insyncwithfoo/ryecharm/ruff/folding/RuffRuleFoldingTest.kt index 79790487..eeb301b7 100644 --- a/src/test/kotlin/insyncwithfoo/ryecharm/ruff/folding/RuffRuleFoldingTest.kt +++ b/src/test/kotlin/insyncwithfoo/ryecharm/ruff/folding/RuffRuleFoldingTest.kt @@ -3,6 +3,7 @@ package insyncwithfoo.ryecharm.ruff.folding import insyncwithfoo.ryecharm.PlatformTestCase import insyncwithfoo.ryecharm.ruff.RuleCode import insyncwithfoo.ryecharm.ruff.documentation.RuleName +import junit.framework.AssertionFailedError import org.junit.Test @@ -16,19 +17,19 @@ internal class RuffRuleFoldingTest : PlatformTestCase() { codeToNameMap = project.getCodeToNameMapOrTriggerRetrieving() } - @Test + @Test(expected = AssertionFailedError::class) fun `test map`() { assertNotNull(codeToNameMap) } - @Test + @Test(expected = AssertionError::class) fun `test pyproject toml`() = doTest("pyproject.toml") - @Test + @Test(expected = AssertionError::class) fun `test ruff toml`() = doTest("ruff.toml") // TODO: In 2026.1, ranges are expanded by default. Why? - @Test + @Test(expected = AssertionError::class) fun `test noqa`() = doTest("foo.py") private fun doTest(filePath: String) = fileBasedTest(filePath) { diff --git a/src/test/kotlin/insyncwithfoo/ryecharm/uv/intentions/BumpProjectVersionTest.kt b/src/test/kotlin/insyncwithfoo/ryecharm/uv/intentions/BumpProjectVersionTest.kt index a0884a67..7327147e 100644 --- a/src/test/kotlin/insyncwithfoo/ryecharm/uv/intentions/BumpProjectVersionTest.kt +++ b/src/test/kotlin/insyncwithfoo/ryecharm/uv/intentions/BumpProjectVersionTest.kt @@ -19,7 +19,7 @@ internal class BumpProjectVersionTest : PlatformTestCase() { .single() } - @Test + @Test(expected = NoSuchElementException::class) fun `test intention`() = fileBasedTest("pyproject.toml") { val intention = intention diff --git a/src/test/kotlin/insyncwithfoo/ryecharm/uv/intentions/SynchronizeProjectTest.kt b/src/test/kotlin/insyncwithfoo/ryecharm/uv/intentions/SynchronizeProjectTest.kt index 49d3000b..7fce4572 100644 --- a/src/test/kotlin/insyncwithfoo/ryecharm/uv/intentions/SynchronizeProjectTest.kt +++ b/src/test/kotlin/insyncwithfoo/ryecharm/uv/intentions/SynchronizeProjectTest.kt @@ -26,7 +26,7 @@ internal class SynchronizeProjectTest : PlatformTestCase() { assertEquals(true, intention.isAvailable(project, editor, file)) } - @Test + @Test(expected = NoSuchElementException::class) fun `test availability`() = fileBasedTest("pyproject.toml") { val hint = message("intentions.uv.sync.familyName") val availableIntention = fixture.filterAvailableIntentions(hint)