import unittest from task_bench.framework_tests import is_test_file class IsTestFileTest(unittest.TestCase): def test_tells_a_php_file_ending_in_Test_wherever_it_stands(self): for path in ("src/PickTest.php", "PickTest.php", "app/Models/UserTest.php"): with self.subTest(path=path): self.assertTrue(is_test_file(path)) def test_tells_the_names_node_test_finds_in_each_suffix_stryker_covers(self): for path in ("src/pick-test.js", "pick_test.mjs", "src/test-pick.cjs", "src/test.ts", "a/b/pick-test.ts", "test.js", "x_test.mts", "test-x.cts"): with self.subTest(path=path): self.assertTrue(is_test_file(path)) def test_tells_what_is_test_tells(self): for path in ("src/pick.test.js", "src/pick.spec.ts", "tests/pick.php", "a/__tests__/pick.js", "pick_test.go", "test_pick.py"): with self.subTest(path=path): self.assertTrue(is_test_file(path)) def test_takes_other_code_as_code(self): for path in ("src/Pick.php", "src/Tester.php", "src/PickTest.phps", "src/pick.js", "src/latest.js", "src/pick-tests.js", "src/pickTest.js", "src/test-pick.json", "src/pick-test.jsx", "src/pick-test.tsx", "src/contest.ts", "src/Test.php.bak"): with self.subTest(path=path): self.assertFalse(is_test_file(path))