Skip to content

Commit

Permalink
Fix collections import
Browse files Browse the repository at this point in the history
  • Loading branch information
noumar committed Sep 8, 2023
1 parent 94a47e0 commit df2355a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
"""

import sys
import collections

if sys.version_info[0:2] == (2, 6):
import unittest2 as unittest
else:
import unittest

if sys.version_info[0] == 3 and sys.version_info[1] > 2:
from collections.abc import Iterable, Iterator
else:
from collections import Iterable, Iterator

from iso639 import Iso639, languages
from examples.logic import map_language
from pycountry import languages as pclanguages
Expand Down Expand Up @@ -112,8 +116,8 @@ def test_len(self):
self.assertEqual(len(languages), 7981)

def test_iter(self):
self.assertIsInstance(languages, collections.Iterable)
self.assertIsInstance(iter(languages), collections.Iterator)
self.assertIsInstance(languages, Iterable)
self.assertIsInstance(iter(languages), Iterator)

def test_exceptions(self):
self.assertRaises(KeyError, languages.get, part1='En') # Wrong value
Expand Down

0 comments on commit df2355a

Please sign in to comment.