Add hypothesis test for history.Entry.from_str

This commit is contained in:
Florian Bruhin 2016-06-09 17:33:20 +02:00
parent 33f01d8375
commit d3dd6d2f77

View File

@ -20,7 +20,8 @@
"""Tests for the global page history."""
import pytest
import hypothesis
from hypothesis import strategies
from PyQt5.QtCore import QUrl
from qutebrowser.browser import history
@ -111,3 +112,12 @@ def test_entry_parse_valid(line, expected):
def test_entry_parse_invalid(line):
with pytest.raises(ValueError):
history.Entry.from_str(line)
@hypothesis.given(strategies.text())
def test_entry_parse_hypothesis(text):
"""Make sure parsing works or gives us ValueError"""
try:
history.Entry.from_str(text)
except ValueError:
pass