stchris / untangle

Converts XML to Python objects
MIT License
611 stars 83 forks source link

support 'in' and 'not in' operator #40

Closed reverbc closed 7 years ago

reverbc commented 7 years ago

Adding support for the in and not in operator by implementing __contains__() method as the following example:

>>> 'child' in untangle.parse('<root/>').root
... False
>>> 'child' in untangle.parse('<root><child>value</child></root>').root
... True

This could be useful when dealing with dynamic xml API response.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.3%) to 35.577% when pulling 63baee54e743728dc4f5c474a97bb549aff46fd5 on reverbc:support-membership-operator into 2119763f721b23588b6223f28264843f6fc9f750 on stchris:master.

stchris commented 7 years ago

Very nice! Can you add yourself to the AUTHORS file as well?

reverbc commented 7 years ago

@stchris Just did. Thanks for accepting the PRs 🎉

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.2%) to 35.514% when pulling 87fb7f11c2b43152731f168c7811233168c4d797 on reverbc:support-membership-operator into 2119763f721b23588b6223f28264843f6fc9f750 on stchris:master.