spielwiese
Last change
on this file since 33300d was
33300d,
checked in by Oleksandr Motsak <motsak@…>, 11 years ago
|
Fixed the test Manual/pyobject_related_functions.tst (which was failing for some python builds)
Note: string attribute __doc__ is documented differently in some python versions
e.g. "str(object) -> ..." vs "str(object='') -> ..."
see http://bugs.python.org/review/15516/diff2/5609:6750/Objects/stringobject.c?context=&column_width=80
|
-
Property mode set to
100644
|
File size:
539 bytes
|
Line | |
---|
1 | LIB "tst.lib"; tst_init(); |
---|
2 | pyobject pystr = "Kublai Khan"; |
---|
3 | |
---|
4 | // Additional functionality through attrib |
---|
5 | attrib(pystr, "__class__"); // should always be "<type 'str'>"... |
---|
6 | proc(attrib(pystr, "count"))("K"); |
---|
7 | |
---|
8 | pystr."__class__"; // <- Short notations |
---|
9 | pystr.count("a"); // Even shorter (if attribute's name is valid and unused) |
---|
10 | |
---|
11 | python_run("def func(): return 17"); |
---|
12 | attrib(func); |
---|
13 | attrib(func, "func_name"); |
---|
14 | attrib(func, "func_name", "byAnyOtherName"); |
---|
15 | attrib(func, "func_name"); |
---|
16 | tst_status(1);$ |
---|
Note: See
TracBrowser
for help on using the repository browser.