diff --git a/.travis.yml b/.travis.yml index b0502fb..2f2a5fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ notifications: language: python python: - - "2.6" - "2.7" - "3.3" - "3.4" @@ -20,7 +19,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)))) +