Skip to content

Commit 353fdc6

Browse files
committed
Make the tests run under python 2
1 parent 904764e commit 353fdc6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/testextensions.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import sys
22
import pickle
33
import typing
4-
import collections.abc
54
from unittest import TestCase, main, skipUnless
65
from mypy_extensions import TypedDict
76

@@ -49,7 +48,9 @@ def test_basics_iterable_syntax(self):
4948
Emp = TypedDict('Emp', {'name': str, 'id': int})
5049
self.assertIsSubclass(Emp, dict)
5150
self.assertIsSubclass(Emp, typing.MutableMapping)
52-
self.assertNotIsSubclass(Emp, collections.abc.Sequence)
51+
if sys.version_info[0] >= 3:
52+
import collections.abc
53+
self.assertNotIsSubclass(Emp, collections.abc.Sequence)
5354
jim = Emp(name='Jim', id=1)
5455
self.assertIs(type(jim), dict)
5556
self.assertEqual(jim['name'], 'Jim')
@@ -64,7 +65,9 @@ def test_basics_keywords_syntax(self):
6465
Emp = TypedDict('Emp', name=str, id=int)
6566
self.assertIsSubclass(Emp, dict)
6667
self.assertIsSubclass(Emp, typing.MutableMapping)
67-
self.assertNotIsSubclass(Emp, collections.abc.Sequence)
68+
if sys.version_info[0] >= 3:
69+
import collections.abc
70+
self.assertNotIsSubclass(Emp, collections.abc.Sequence)
6871
jim = Emp(name='Jim', id=1) # type: ignore # mypy doesn't support keyword syntax yet
6972
self.assertIs(type(jim), dict)
7073
self.assertEqual(jim['name'], 'Jim')

0 commit comments

Comments
 (0)