from test.test_support import verify, TESTFN, TestFailed
from UserList import UserList
+# verify expected attributes exist
+f = file(TESTFN, 'w')
+softspace = f.softspace
+f.name # merely shouldn't blow up
+f.mode # ditto
+f.closed # ditto
+
+# verify softspace is writable
+f.softspace = softspace # merely shouldn't blow up
+
+# verify the others aren't
+for attr in 'name', 'mode', 'closed':
+ try:
+ setattr(f, attr, 'oops')
+ except TypeError:
+ pass
+ else:
+ raise TestFailed('expected TypeError setting file attr %r' % attr)
+f.close()
+
# verify writelines with instance sequence
l = UserList(['1', '2'])
f = open(TESTFN, 'wb')
0, /* tp_call */
0, /* tp_str */
PyObject_GenericGetAttr, /* tp_getattro */
- 0, /* tp_setattro */
+ /* softspace is writable: we must supply tp_setattro */
+ PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
file_doc, /* tp_doc */