(self)
| 412 | self.assertEqual(c, comp) |
| 413 | |
| 414 | def test_local_file_completions(self): |
| 415 | ip = get_ipython() |
| 416 | with TemporaryWorkingDirectory(): |
| 417 | prefix = "./foo" |
| 418 | suffixes = ["1", "2"] |
| 419 | names = [prefix + s for s in suffixes] |
| 420 | for n in names: |
| 421 | open(n, "w", encoding="utf-8").close() |
| 422 | |
| 423 | # Check simple completion |
| 424 | c = ip.complete(prefix)[1] |
| 425 | self.assertEqual(c, names) |
| 426 | |
| 427 | test_cases = { |
| 428 | "function call": 'a = f("', |
| 429 | "shell bang": "!ls ", |
| 430 | "ls magic": r"%ls ", |
| 431 | "alias ls": "ls ", |
| 432 | } |
| 433 | for name, code in test_cases.items(): |
| 434 | cmd = f"{code}{prefix}" |
| 435 | c = ip.complete(prefix, cmd)[1] |
| 436 | comp = {prefix + s for s in suffixes} |
| 437 | self.assertTrue(comp.issubset(set(c)), msg=f"completes in {name}") |
| 438 | |
| 439 | def test_quoted_file_completions(self): |
| 440 | ip = get_ipython() |
nothing calls this directly
no test coverage detected