> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Remove Redundant Boolean

#### Sourcery refactoring id: `remove-redundant-boolean`

#### Description

Removes redundant booleans from tests.

#### Before

```python
hat_prices = []
while True and hat in hats:
    hat_prices.append(hat.price)
    hats.remove(hat)


assert len(hat_prices) > 10 and False
```

#### After

```python
while hat in hats:
    hat_prices.append(hat.price)
    hats.remove(hat)

assert False
```

#### Explanation

Boolean values like `True` or `False` in boolean operations like `and` or `or`
may be redundant, and can be removed to simplify the code without affecting its
functionality. This refactoring will often compose with other refactorings where
boolean operations have been combined.

See also: [`remove-redundant-if`](/reference/refactorings/python/remove-redundant-if/)
