2018-02-18 22:51:04 -05:00
|
|
|
# test that fixed dictionaries cannot be modified
|
|
|
|
|
|
|
|
try:
|
2023-08-22 11:15:46 -04:00
|
|
|
import errno
|
2018-02-18 22:51:04 -05:00
|
|
|
except ImportError:
|
|
|
|
print("SKIP")
|
|
|
|
raise SystemExit
|
|
|
|
|
2023-08-22 11:15:46 -04:00
|
|
|
# Save a copy of errno.errorcode, so we can check later
|
2018-02-18 22:51:04 -05:00
|
|
|
# that it hasn't been modified.
|
2023-08-22 11:15:46 -04:00
|
|
|
errorcode_copy = errno.errorcode.copy()
|
2018-02-18 22:51:04 -05:00
|
|
|
|
|
|
|
try:
|
2023-08-22 11:15:46 -04:00
|
|
|
errno.errorcode.popitem()
|
2018-02-18 22:51:04 -05:00
|
|
|
except TypeError:
|
|
|
|
print("TypeError")
|
|
|
|
|
|
|
|
try:
|
2023-08-22 11:15:46 -04:00
|
|
|
errno.errorcode.pop(0)
|
2018-02-18 22:51:04 -05:00
|
|
|
except TypeError:
|
|
|
|
print("TypeError")
|
|
|
|
|
|
|
|
try:
|
2023-08-22 11:15:46 -04:00
|
|
|
errno.errorcode.setdefault(0, 0)
|
2018-02-18 22:51:04 -05:00
|
|
|
except TypeError:
|
|
|
|
print("TypeError")
|
|
|
|
|
|
|
|
try:
|
2023-08-22 11:15:46 -04:00
|
|
|
errno.errorcode.update([(1, 2)])
|
2018-02-18 22:51:04 -05:00
|
|
|
except TypeError:
|
|
|
|
print("TypeError")
|
|
|
|
|
|
|
|
try:
|
2023-08-22 11:15:46 -04:00
|
|
|
del errno.errorcode[1]
|
2018-02-18 22:51:04 -05:00
|
|
|
except TypeError:
|
|
|
|
print("TypeError")
|
|
|
|
|
|
|
|
try:
|
2023-08-22 11:15:46 -04:00
|
|
|
errno.errorcode[1] = 'foo'
|
2018-02-18 22:51:04 -05:00
|
|
|
except TypeError:
|
|
|
|
print("TypeError")
|
|
|
|
|
|
|
|
try:
|
2023-08-22 11:15:46 -04:00
|
|
|
errno.errorcode.clear()
|
2018-02-18 22:51:04 -05:00
|
|
|
except TypeError:
|
|
|
|
print("TypeError")
|
|
|
|
|
2023-08-22 11:15:46 -04:00
|
|
|
assert errno.errorcode == errorcode_copy
|