| 1 |
from hypothesis import given, reject |
| 2 |
from hypothesis import strategies as st |
| 3 |
|
| 4 |
import isort.comments |
| 5 |
|
| 6 |
|
| 7 |
@given( |
| 8 |
comments=st.one_of(st.none(), st.lists(st.text())), |
| 9 |
original_string=st.text(), |
| 10 |
removed=st.booleans(), |
| 11 |
comment_prefix=st.text(), |
| 12 |
) |
| 13 |
def test_fuzz_add_to_line( |
| 14 |
comments: list[str] | None, original_string: str, removed: bool, comment_prefix: str |
| 15 |
) -> None: |
| 16 |
try: |
| 17 |
isort.comments.add_to_line( |
| 18 |
comments=comments, |
| 19 |
original_string=original_string, |
| 20 |
removed=removed, |
| 21 |
comment_prefix=comment_prefix, |
| 22 |
) |
| 23 |
except ValueError: |
| 24 |
reject() |