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