FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update test_exception_hierarchy.py from Cpython v3.11.2 by Masorubka1 · Pull Request #4818 · RustPython/RustPython · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
12 changes: 6 additions & 6 deletions Lib/test/test_exception_hierarchy.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import unittest
import errno
from errno import EEXIST
import sys


class SubOSError(OSError):
Expand Down Expand Up @@ -41,10 +40,10 @@ def test_builtin_errors(self):
self.assertIs(EnvironmentError, OSError)

def test_socket_errors(self):
self.assertIs(socket.error, IOError)
self.assertIs(socket.error, OSError)
self.assertIs(socket.gaierror.__base__, OSError)
self.assertIs(socket.herror.__base__, OSError)
self.assertIs(socket.timeout.__base__, OSError)
self.assertIs(socket.timeout, TimeoutError)

def test_select_error(self):
self.assertIs(select.error, OSError)
Expand All @@ -64,7 +63,7 @@ def test_select_error(self):
+-- InterruptedError EINTR
+-- IsADirectoryError EISDIR
+-- NotADirectoryError ENOTDIR
+-- PermissionError EACCES, EPERM
+-- PermissionError EACCES, EPERM, ENOTCAPABLE
+-- ProcessLookupError ESRCH
+-- TimeoutError ETIMEDOUT
"""
Expand All @@ -76,6 +75,8 @@ def _make_map(s):
continue
excname, _, errnames = line.partition(' ')
for errname in filter(None, errnames.strip().split(', ')):
if errname == "ENOTCAPABLE" and not hasattr(errno, errname):
continue
_map[getattr(errno, errname)] = getattr(builtins, excname)
return _map
_map = _make_map(_pep_map)
Expand All @@ -93,7 +94,7 @@ def test_errno_mapping(self):
othercodes = set(errno.errorcode) - set(self._map)
for errcode in othercodes:
e = OSError(errcode, "Some message")
self.assertIs(type(e), OSError)
self.assertIs(type(e), OSError, repr(e))

def test_try_except(self):
filename = "some_hopefully_non_existing_file"
Expand Down Expand Up @@ -128,7 +129,6 @@ def test_windows_error(self):
self.assertNotIn('winerror', dir(OSError))

@unittest.skip("TODO: RUSTPYTHON")
@unittest.skipIf(sys.platform == 'win32', 'winerror not filled yet')
def test_posix_error(self):
e = OSError(EEXIST, "File already exists", "foo.txt")
self.assertEqual(e.errno, EEXIST)
Expand Down

Back | FazBrowse Home | New Git URL