Skip to content

Fix FutureWarnings for testing lxml elements#979

Merged
geographika merged 1 commit into
geopython:masterfrom
geographika:lxml-warnings
Mar 6, 2025
Merged

Fix FutureWarnings for testing lxml elements#979
geographika merged 1 commit into
geopython:masterfrom
geographika:lxml-warnings

Conversation

@geographika
Copy link
Copy Markdown
Contributor

Fixes the following FutureWarnings displayed when running the test suite:

  /home/runner/work/OWSLib/OWSLib/owslib/feature/wfs110.py:445: FutureWarning: Truth-testing of elements was a source of confusion and will always return True in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
    mdelem = doc.find(

Element objects are considered a False value if they have no children, so using or could skip the first result.

See https://github.com/lxml/lxml/blob/0eb4f0029497957e58a9f15280b3529bdb18d117/src/lxml/etree.pyx#L1313

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant