(self)
| 895 | |
| 896 | @skip_if_ABSTFN_contains_backslash |
| 897 | def test_realpath_nonterminal_file(self): |
| 898 | try: |
| 899 | with open(ABSTFN, 'w') as f: |
| 900 | f.write('test_posixpath wuz ere') |
| 901 | self.assertEqual(realpath(ABSTFN, strict=False), ABSTFN) |
| 902 | self.assertEqual(realpath(ABSTFN, strict=ALL_BUT_LAST), ABSTFN) |
| 903 | self.assertEqual(realpath(ABSTFN, strict=True), ABSTFN) |
| 904 | self.assertEqual(realpath(ABSTFN, strict=ALLOW_MISSING), ABSTFN) |
| 905 | |
| 906 | self.assertEqual(realpath(ABSTFN + "/", strict=False), ABSTFN) |
| 907 | self.assertRaises(NotADirectoryError, realpath, ABSTFN + "/", strict=ALL_BUT_LAST) |
| 908 | self.assertRaises(NotADirectoryError, realpath, ABSTFN + "/", strict=True) |
| 909 | self.assertRaises(NotADirectoryError, realpath, ABSTFN + "/", |
| 910 | strict=ALLOW_MISSING) |
| 911 | |
| 912 | self.assertEqual(realpath(ABSTFN + "/.", strict=False), ABSTFN) |
| 913 | self.assertRaises(NotADirectoryError, realpath, ABSTFN + "/.", strict=ALL_BUT_LAST) |
| 914 | self.assertRaises(NotADirectoryError, realpath, ABSTFN + "/.", strict=True) |
| 915 | self.assertRaises(NotADirectoryError, realpath, ABSTFN + "/.", |
| 916 | strict=ALLOW_MISSING) |
| 917 | |
| 918 | self.assertEqual(realpath(ABSTFN + "/..", strict=False), dirname(ABSTFN)) |
| 919 | self.assertRaises(NotADirectoryError, realpath, ABSTFN + "/..", strict=ALL_BUT_LAST) |
| 920 | self.assertRaises(NotADirectoryError, realpath, ABSTFN + "/..", strict=True) |
| 921 | self.assertRaises(NotADirectoryError, realpath, ABSTFN + "/..", |
| 922 | strict=ALLOW_MISSING) |
| 923 | |
| 924 | self.assertEqual(realpath(ABSTFN + "/subdir", strict=False), ABSTFN + "/subdir") |
| 925 | self.assertRaises(NotADirectoryError, realpath, ABSTFN + "/subdir", strict=ALL_BUT_LAST) |
| 926 | self.assertRaises(NotADirectoryError, realpath, ABSTFN + "/subdir", strict=True) |
| 927 | self.assertRaises(NotADirectoryError, realpath, ABSTFN + "/subdir", |
| 928 | strict=ALLOW_MISSING) |
| 929 | finally: |
| 930 | os_helper.unlink(ABSTFN) |
| 931 | |
| 932 | @os_helper.skip_unless_symlink |
| 933 | @skip_if_ABSTFN_contains_backslash |
nothing calls this directly
no test coverage detected