8000 Implementing GetDynamicMemberNames() for PyObject by jbw3 · Pull Request #690 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content

Implementing GetDynamicMemberNames() for PyObject #690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 18, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixing unit test
  • Loading branch information
John Wilkes committed Jun 17, 2018
commit 23aef26fd5754c68e10a1377004a21f436305730
16 changes: 15 additions & 1 deletion src/embed_tests/TestPyObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,34 @@ public void TestGetDynamicMemberNames()
"__class__",
"__delattr__",
"__dict__",
#if PYTHON3
"__dir__",
#endif
"__doc__",
#if PYTHON3
"__eq__",
#endif
"__format__",
#if PYTHON3
"__ge__",
#endif
"__getattribute__",
#if PYTHON3
"__gt__",
#endif
"__hash__",
"__init__",
#if PYTHON36
"__init_subclass__",
#endif
#if PYTHON3
"__le__",
"__lt__",
#endif
"__module__",
#if PYTHON3
"__ne__",
#endif
"__new__",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defines here make the whole thing quite brittle, I think, to me it would be perfectly fine to just check that the explicitly added members exist (i.e. add, getNumber etc.).

"__reduce__",
"__reduce_ex__",
Expand All @@ -60,7 +74,7 @@ public void TestGetDynamicMemberNames()
PyDict locals = new PyDict();

PythonEngine.Exec(@"
class MemberNamesTest:
class MemberNamesTest(object):
def __init__(self):
self.member1 = 123
self.member2 = 'Test string'
Expand Down
0