MCPcopy Create free account
hub / github.com/ParzivalHack/PySpector / setUp

Method setUp

tests/unit/test_get_asts.py:12–37  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

10class TestGetPythonFileAsts(unittest.TestCase):
11
12 def setUp(self):
13 # Create a temporary directory structure for tests
14 self.test_dir = tempfile.TemporaryDirectory()
15 self.base_path = Path(self.test_dir.name)
16
17 # Valid python file
18 self.valid_file = self.base_path / "valid.py"
19 self.valid_file.write_text("x = 10", encoding="utf-8")
20
21 # Syntax warning file
22 self.warning_syntax = self.base_path / "warning_err.py"
23 self.warning_syntax.write_bytes(b'path = "c:\windows"')
24
25 # Invalid syntax file
26 self.invalid_syntax = self.base_path / "syntax_err.py"
27 self.invalid_syntax.write_text("def broken_function(:", encoding="utf-8")
28
29 # Encoding error file
30 self.encoding_err = self.base_path / "encoding_err.py"
31 self.encoding_err.write_bytes(b"\xff\xfe\x00\x00")
32
33 # Fixture file (should be skipped)
34 self.fixture_dir = self.base_path / "tests" / "fixtures"
35 self.fixture_dir.mkdir(parents=True)
36 self.fixture_file = self.fixture_dir / "fixture_file.py"
37 self.fixture_file.write_text("y = 20", encoding="utf-8")
38
39 def tearDown(self):
40 self.test_dir.cleanup()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected