(self)
| 494 | os_helper.unlink(ABSTFN) |
| 495 | |
| 496 | def test_realpath_invalid_paths(self): |
| 497 | path = '/\x00' |
| 498 | self.assertRaises(ValueError, realpath, path, strict=False) |
| 499 | self.assertRaises(ValueError, realpath, path, strict=ALL_BUT_LAST) |
| 500 | self.assertRaises(ValueError, realpath, path, strict=True) |
| 501 | self.assertRaises(ValueError, realpath, path, strict=ALLOW_MISSING) |
| 502 | path = b'/\x00' |
| 503 | self.assertRaises(ValueError, realpath, path, strict=False) |
| 504 | self.assertRaises(ValueError, realpath, path, strict=ALL_BUT_LAST) |
| 505 | self.assertRaises(ValueError, realpath, path, strict=True) |
| 506 | self.assertRaises(ValueError, realpath, path, strict=ALLOW_MISSING) |
| 507 | path = '/nonexistent/x\x00' |
| 508 | self.assertRaises(ValueError, realpath, path, strict=False) |
| 509 | self.assertRaises(FileNotFoundError, realpath, path, strict=ALL_BUT_LAST) |
| 510 | self.assertRaises(FileNotFoundError, realpath, path, strict=True) |
| 511 | self.assertRaises(ValueError, realpath, path, strict=ALLOW_MISSING) |
| 512 | path = b'/nonexistent/x\x00' |
| 513 | self.assertRaises(ValueError, realpath, path, strict=False) |
| 514 | self.assertRaises(FileNotFoundError, realpath, path, strict=ALL_BUT_LAST) |
| 515 | self.assertRaises(FileNotFoundError, realpath, path, strict=True) |
| 516 | self.assertRaises(ValueError, realpath, path, strict=ALLOW_MISSING) |
| 517 | path = '/\x00/..' |
| 518 | self.assertRaises(ValueError, realpath, path, strict=False) |
| 519 | self.assertRaises(ValueError, realpath, path, strict=ALL_BUT_LAST) |
| 520 | self.assertRaises(ValueError, realpath, path, strict=True) |
| 521 | self.assertRaises(ValueError, realpath, path, strict=ALLOW_MISSING) |
| 522 | path = b'/\x00/..' |
| 523 | self.assertRaises(ValueError, realpath, path, strict=False) |
| 524 | self.assertRaises(ValueError, realpath, path, strict=ALL_BUT_LAST) |
| 525 | self.assertRaises(ValueError, realpath, path, strict=True) |
| 526 | self.assertRaises(ValueError, realpath, path, strict=ALLOW_MISSING) |
| 527 | |
| 528 | path = '/nonexistent/x\x00/..' |
| 529 | self.assertRaises(ValueError, realpath, path, strict=False) |
| 530 | self.assertRaises(FileNotFoundError, realpath, path, strict=ALL_BUT_LAST) |
| 531 | self.assertRaises(FileNotFoundError, realpath, path, strict=True) |
| 532 | self.assertRaises(ValueError, realpath, path, strict=ALLOW_MISSING) |
| 533 | path = b'/nonexistent/x\x00/..' |
| 534 | self.assertRaises(ValueError, realpath, path, strict=False) |
| 535 | self.assertRaises(FileNotFoundError, realpath, path, strict=ALL_BUT_LAST) |
| 536 | self.assertRaises(FileNotFoundError, realpath, path, strict=True) |
| 537 | self.assertRaises(ValueError, realpath, path, strict=ALLOW_MISSING) |
| 538 | |
| 539 | path = '/\udfff' |
| 540 | if sys.platform == 'win32': |
| 541 | self.assertEqual(realpath(path, strict=False), path) |
| 542 | self.assertRaises(FileNotFoundError, realpath, path, strict=True) |
| 543 | self.assertEqual(realpath(path, strict=ALLOW_MISSING), path) |
| 544 | else: |
| 545 | self.assertRaises(UnicodeEncodeError, realpath, path, strict=False) |
| 546 | self.assertRaises(UnicodeEncodeError, realpath, path, strict=ALL_BUT_LAST) |
| 547 | self.assertRaises(UnicodeEncodeError, realpath, path, strict=True) |
| 548 | self.assertRaises(UnicodeEncodeError, realpath, path, strict=ALLOW_MISSING) |
| 549 | path = '/nonexistent/\udfff' |
| 550 | if sys.platform == 'win32': |
| 551 | self.assertEqual(realpath(path, strict=False), path) |
| 552 | self.assertEqual(realpath(path, strict=ALLOW_MISSING), path) |
| 553 | else: |
nothing calls this directly
no test coverage detected