summaryrefslogtreecommitdiff
path: root/tests/unit/misc/test_split_hypothesis.py
blob: 356095e2ac9f09d423138b7303e4e11a0f88aa46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later

"""Hypothesis tests for qutebrowser.misc.split."""

import pytest
import hypothesis
from hypothesis import strategies

from qutebrowser.misc import split


@pytest.mark.parametrize('keep', [True, False])
@hypothesis.given(strategies.text())
def test_split(keep, s):
    split.split(s, keep=keep)


@pytest.mark.parametrize('keep', [True, False])
@pytest.mark.parametrize('maxsplit', [None, 0, 1])
@hypothesis.given(strategies.text())
def test_simple_split(keep, maxsplit, s):
    split.simple_split(s, keep=keep, maxsplit=maxsplit)