-
Notifications
You must be signed in to change notification settings - Fork 671
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
Make deprecated API available for backend="win32" only #251
Conversation
…rol_identifiers(), rename is_content_element to content_only, add more COMError handlers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't have too much time to review this PR. Maybe I'll take a look again tomorrow. Sorry.
@@ -556,19 +550,21 @@ def _ctrl_identifiers(self): | |||
|
|||
return control_name_map | |||
|
|||
def print_control_identifiers(self, depth = 2): | |||
def print_control_identifiers(self, depth = None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Printing the whole hierarchy by default looks a bit exaggerated for me. User might get confused with a huge number of prints spat out by the function. Maybe we could leave depth=2
but print an info before the all identifiers that there are other options if more levels are required. Something like:
"Print out identifiers for {0} levels. Use 'depth' argument to get info about deeper sub-levels".format(depth)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure user could find this message quickly even for one level of the subtree. Will leave a TODO to think about that.
'Hiya' : 1, | ||
'hiy\xe4' : 2, | ||
'test3' : 3, | ||
1: 324} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if the dictionary strings will be declared explicitly as unicode strings the search order of "test_dict" won't change between different python versions
test_dict = {
u'Hiya' : 1,
u'hiy\xe4' : 2,
u'test3' : 3,
1: 324}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will try, though from __future__ import unicode_literals
should do the trick but it didn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked into fuzzydict.py today. With the given test_dict
, a lookup for 'hiya' produces two equal ratio scores: 'Hiya'=0.75 and 'hia\xe4' = 0.75 thus the implementation of FuzzyDict
will always have instabilities since it's based on a regular dict
that has no guarantee on elements order. As an option we could consider to subclass OrderedDict
but if we want to keep the insertion order this new FuzzyDict object (based on OrderedDict) must be initialized with a list and NOT with a regular dict
. So instead of { u'Hiya': 1, u'hiy\xe4:2, ...}
it has to be
test_dict = [ (u'Hiya', 1), (u'hiy\xe4' : 2), (u'test3' : 3), (1: 324)]
It also requires Py2.7 minimum
Current coverage is 95.00% (diff: 86.15%)@@ master #251 diff @@
==========================================
Files 47 47
Lines 19205 19206 +1
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 18186 18246 +60
+ Misses 1019 960 -59
Partials 0 0
|
print_control_identifiers()
.children()
anddescendants()
process-agnostic by default (useful for Win10 Calculator example). Yes, some windows in Store apps can have children in different processes! So we could miss them even if usingDesktop(backend"uia")
object as a root.Surprisingly FuzzyDict tests are a bit unstable (2 failures in ~2 out of 8 runs).
testCheckBoxes
for native TreeView is also painful area. :(