From 08c00901c1920252f8bdbfcf9517504ba1040034 Mon Sep 17 00:00:00 2001 From: Clark DuVall Date: Fri, 29 Sep 2017 08:40:22 -0700 Subject: [PATCH] Remove Python 2.6 support --- .travis.yml | 1 - setup.py | 1 - tests/test_serializer.py | 27 +++++++++++++++------------ tox.ini | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index efe5ef8..525ac87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ python: - 3.4 - 3.3 - 2.7 - - 2.6 - pypy install: - pip install -r requirements.txt diff --git a/setup.py b/setup.py index 8339c09..ae16194 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,6 @@ 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', diff --git a/tests/test_serializer.py b/tests/test_serializer.py index 3d123a1..4cf1e06 100644 --- a/tests/test_serializer.py +++ b/tests/test_serializer.py @@ -158,7 +158,7 @@ class ASerializer(Serializer): o = Obj(a=None) data = ASerializer(o).data - self.assertFalse('a' in data) + self.assertNotIn('a', data) o = Obj(a='5') data = ASerializer(o).data @@ -168,7 +168,8 @@ class ASerializer(Serializer): a = IntField() o = Obj(a=None) - self.assertRaises(TypeError, lambda: ASerializer(o).data) + with self.assertRaises(TypeError): + ASerializer(o).data def test_optional_methodfield(self): class ASerializer(Serializer): @@ -179,7 +180,7 @@ def get_a(self, obj): o = Obj(a=None) data = ASerializer(o).data - self.assertFalse('a' in data) + self.assertNotIn('a', data) o = Obj(a='5') data = ASerializer(o).data @@ -192,26 +193,28 @@ def get_a(self, obj): return obj.a o = Obj(a=None) - self.assertRaises(TypeError, lambda: ASerializer(o).data) + with self.assertRaises(TypeError): + ASerializer(o).data def test_error_on_data(self): - self.assertRaises(RuntimeError, lambda: Serializer(data='foo')) + with self.assertRaises(RuntimeError): + Serializer(data='foo') def test_serializer_with_custom_output_label(self): class ASerializer(Serializer): - context = StrField(label="@context") - content = MethodField(label="@content") + context = StrField(label='@context') + content = MethodField(label='@content') def get_content(self, obj): return obj.content - o = Obj(context="http://foo/bar/baz/", content="http://baz/bar/foo/") + o = Obj(context='http://foo/bar/baz/', content='http://baz/bar/foo/') data = ASerializer(o).data - self.assertTrue("@context" in data) - self.assertEqual(data["@context"], "http://foo/bar/baz/") - self.assertTrue("@content" in data) - self.assertEqual(data["@content"], "http://baz/bar/foo/") + self.assertIn('@context', data) + self.assertEqual(data['@context'], 'http://foo/bar/baz/') + self.assertIn('@content', data) + self.assertEqual(data['@content'], 'http://baz/bar/foo/') if __name__ == '__main__': diff --git a/tox.ini b/tox.ini index 83c5e7e..e85c89c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py26, py27, py32, py33, py34, py35, py36, pypy +envlist = py27, py32, py33, py34, py35, py36, pypy [testenv] commands = {envpython} setup.py test