---
source: crates/ty_test/src/lib.rs
expression: snapshot
---
---
mdtest name: tuples.md - Comparison: Tuples - Chained comparisons with elements that incorrectly implement `__bool__`
mdtest path: crates/ty_python_semantic/resources/mdtest/comparison/tuples.md
---

# Python source files

## mdtest_snippet.py

```
 1 | class NotBoolable:
 2 |     __bool__: int = 5
 3 | 
 4 | class Comparable:
 5 |     def __lt__(self, other) -> NotBoolable:
 6 |         return NotBoolable()
 7 | 
 8 |     def __gt__(self, other) -> NotBoolable:
 9 |         return NotBoolable()
10 | 
11 | a = (1, Comparable())
12 | b = (1, Comparable())
13 | 
14 | # error: [unsupported-bool-conversion]
15 | a < b < b
16 | 
17 | a < b  # fine
```

# Diagnostics

```
error[unsupported-bool-conversion]: Boolean conversion is unsupported for type `NotBoolable | Literal[False]`
  --> src/mdtest_snippet.py:15:1
   |
14 | # error: [unsupported-bool-conversion]
15 | a < b < b
   | ^^^^^
16 |
17 | a < b  # fine
   |
info: `__bool__` on `NotBoolable | Literal[False]` must be callable
info: rule `unsupported-bool-conversion` is enabled by default

```
