From d3dd6d2f77fd90db6fbe3ea87d17f47b4c06dbff Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 9 Jun 2016 17:33:20 +0200 Subject: [PATCH] Add hypothesis test for history.Entry.from_str --- tests/unit/browser/test_history.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/unit/browser/test_history.py b/tests/unit/browser/test_history.py index 52d95f8cc..d54876aa8 100644 --- a/tests/unit/browser/test_history.py +++ b/tests/unit/browser/test_history.py @@ -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