From 9f18c9913ddf16c8abcfd77dca9debf714af50f0 Mon Sep 17 00:00:00 2001 From: Thomas Ballinger Date: Fri, 29 Jul 2016 17:39:05 -0400 Subject: [PATCH 1/2] first property-based tests --- .travis.yml | 2 +- tests/test_properties.py | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 tests/test_properties.py diff --git a/.travis.yml b/.travis.yml index b0502fb..b5bfc28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ matrix: install: - "python setup.py install" - - "pip install pyte coverage" + - "pip install pyte coverage hypothesis" script: - nosetests tests diff --git a/tests/test_properties.py b/tests/test_properties.py new file mode 100644 index 0000000..5eef9a0 --- /dev/null +++ b/tests/test_properties.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +import sys +import unittest + +from hypothesis import given +from hypothesis.strategies import text + +from curtsies.formatstring import fmtstr + + +if sys.version_info[0] == 2: + str = unicode + + +class TestFmtStrRendering(unittest.TestCase): + @given(text()) + def test_parse_roundtrip(self, s): + f = fmtstr(s) + self.assertEqual(f, fmtstr(str(f))) + + @given(text()) + def test_parse_roundtrip_as_string(self, s): + f = fmtstr(s) + self.assertEqual(str(f), str(fmtstr(str(f)))) + From 2e9bbe6932dde9e3dd9b4f04143bcf0dd4229819 Mon Sep 17 00:00:00 2001 From: Thomas Ballinger Date: Fri, 29 Jul 2016 17:45:38 -0400 Subject: [PATCH 2/2] unsupport Python 2.6 --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b5bfc28..2f2a5fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ notifications: language: python python: - - "2.6" - "2.7" - "3.3" - "3.4"