mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00

## Summary It's only safe to enforce the `x in "1234567890"` case if `x` is exactly one character, since the set on the right has been reordered as compared to `string.digits`. We can't know if `x` is exactly one character unless it's a literal. And if it's a literal, well, it's kind of silly code in the first place? Closes https://github.com/astral-sh/ruff/issues/13802.
34 lines
705 B
Python
34 lines
705 B
Python
# Errors
|
|
|
|
_ = "0123456789"
|
|
_ = "01234567"
|
|
_ = "0123456789abcdefABCDEF"
|
|
_ = "abcdefghijklmnopqrstuvwxyz"
|
|
_ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
_ = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
_ = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
|
|
_ = " \t\n\r\v\f"
|
|
|
|
_ = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
|
|
_ = (
|
|
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&'
|
|
"'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c"
|
|
)
|
|
_ = id("0123"
|
|
"4567"
|
|
"89")
|
|
|
|
_ = (
|
|
"0123456789"
|
|
).capitalize()
|
|
|
|
_ = (
|
|
"0123456789"
|
|
# with comment
|
|
).capitalize()
|
|
|
|
# OK
|
|
|
|
_ = "1234567890"
|
|
_ = "1234"
|
|
_ = "12" in "12345670"
|