(self)
| 1379 | self.assertNotIn(fname3, str(coder.abs_fnames)) |
| 1380 | |
| 1381 | def test_cmd_read_only(self): |
| 1382 | with GitTemporaryDirectory(): |
| 1383 | io = InputOutput(pretty=False, fancy_input=False, yes=False) |
| 1384 | coder = Coder.create(self.GPT35, None, io) |
| 1385 | commands = Commands(io, coder) |
| 1386 | |
| 1387 | # Create a test file |
| 1388 | test_file = Path("test_read.txt") |
| 1389 | test_file.write_text("Test content") |
| 1390 | |
| 1391 | # Test the /read command |
| 1392 | commands.cmd_read_only(str(test_file)) |
| 1393 | |
| 1394 | # Check if the file was added to abs_read_only_fnames |
| 1395 | self.assertTrue( |
| 1396 | any( |
| 1397 | os.path.samefile(str(test_file.resolve()), fname) |
| 1398 | for fname in coder.abs_read_only_fnames |
| 1399 | ) |
| 1400 | ) |
| 1401 | |
| 1402 | # Test dropping the read-only file |
| 1403 | commands.cmd_drop(str(test_file)) |
| 1404 | |
| 1405 | # Check if the file was removed from abs_read_only_fnames |
| 1406 | self.assertFalse( |
| 1407 | any( |
| 1408 | os.path.samefile(str(test_file.resolve()), fname) |
| 1409 | for fname in coder.abs_read_only_fnames |
| 1410 | ) |
| 1411 | ) |
| 1412 | |
| 1413 | def test_cmd_read_only_from_working_dir(self): |
| 1414 | with GitTemporaryDirectory() as repo_dir: |
nothing calls this directly
no test coverage detected