Skip to content

Commit

Permalink
Import ABCs from collections.abc. Closes #150
Browse files Browse the repository at this point in the history
  • Loading branch information
timofurrer committed Feb 20, 2019
1 parent 557b3ba commit 9f0e834
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
10 changes: 7 additions & 3 deletions .travis.yml
@@ -1,11 +1,15 @@
dist: xenial
language: python
sudo: false
python:
- "2.7"
- "3.6"
- "3.7-dev"
- "pypy"
- "pypy-5.3.1"
- "3.7"
- "3.8-dev"

matrix:
allow_failures:
- python: "3.8-dev"

# command to install dependencies
install:
Expand Down
5 changes: 5 additions & 0 deletions sure/compat.py
Expand Up @@ -5,6 +5,11 @@
import six
from collections import OrderedDict

try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable

from sure.terminal import red, green, yellow


Expand Down
5 changes: 1 addition & 4 deletions sure/old.py
Expand Up @@ -22,10 +22,6 @@
from copy import deepcopy
from pprint import pformat
from functools import wraps
try:
from collections import Iterable
except ImportError:
Iterable = (list, dict, tuple, set)

try:
import __builtin__ as builtins
Expand All @@ -43,6 +39,7 @@
from sure.core import _get_file_name
from sure.core import _get_line_number
from sure.core import itemize_length
from sure.compat import Iterable


def identify_callable_location(callable_object):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_assertion_builder.py
Expand Up @@ -137,7 +137,7 @@ def test_should_be_a():
("this(None).should.be.none")

assert this(1).should.be.an(int)
assert this([]).should.be.a('collections.Iterable')
assert this([]).should.be.a('sure.compat.Iterable')
assert this({}).should_not.be.a(list)

def opposite():
Expand Down

0 comments on commit 9f0e834

Please sign in to comment.