ruff
6660b114 - [`pyupgrade`] Make example error out-of-the-box (`UP023`) (#19291)

Commit
171 days ago
[`pyupgrade`] Make example error out-of-the-box (`UP023`) (#19291) ## Summary Part of #18972 This PR makes [deprecated-c-element-tree (UP023)](https://docs.astral.sh/ruff/rules/deprecated-c-element-tree/#deprecated-c-element-tree-up023)'s example error out-of-the-box. I have no clue why the `import xml.etree.cElementTree` and `from xml.etree import cElementTree` cases are specifically carved out if they do not have an `as ...`, but the tests explicitly call this out, and that's how it is in `pyupgrade`'s source as well. https://github.com/astral-sh/ruff/blob/b5c5f710fc12b5c512a2e5351684b8ffdf33761f/crates/ruff_linter/resources/test/fixtures/pyupgrade/UP023.py#L23-L31 [Old example](https://play.ruff.rs/632b8ce1-393d-45e5-9504-5444ae71a0d8) ```py from xml.etree import cElementTree ``` [New example](https://play.ruff.rs/fef4d378-8c54-41b2-8778-2d02bcbbd7d3) ```py from xml.etree import cElementTree as ET ``` The "Use instead" section was also updated similarly. ## Test Plan <!-- How was it tested? --> N/A, no functionality/tests affected
Author
Parents
Loading