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

## Summary Like https://github.com/astral-sh/ruff/pull/14063, but ensures that we catch cases like `{1, True}` in which the items hash to the same value despite not being identical.
30 lines
456 B
Python
30 lines
456 B
Python
###
|
|
# Errors.
|
|
###
|
|
incorrect_set = {"value1", 23, 5, "value1"}
|
|
incorrect_set = {1, 1, 2}
|
|
incorrect_set_multiline = {
|
|
"value1",
|
|
23,
|
|
5,
|
|
"value1",
|
|
# B033
|
|
}
|
|
incorrect_set = {1, 1}
|
|
incorrect_set = {1, 1,}
|
|
incorrect_set = {0, 1, 1,}
|
|
incorrect_set = {0, 1, 1}
|
|
incorrect_set = {
|
|
0,
|
|
1,
|
|
1,
|
|
}
|
|
incorrect_set = {False, 1, 0}
|
|
|
|
###
|
|
# Non-errors.
|
|
###
|
|
correct_set = {"value1", 23, 5}
|
|
correct_set = {5, "5"}
|
|
correct_set = {5}
|
|
correct_set = {}
|