Skip to content

Commit

Permalink
Remove the embedded copy of six.
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrilRoelandteNovance committed Apr 3, 2014
1 parent 03e050c commit 9fe8fd0
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 432 deletions.
2 changes: 1 addition & 1 deletion OLD_API.md
Expand Up @@ -17,7 +17,7 @@ a assertion toolbox that works fine with [nose](http://code.google.com/p/python-

```python
from sure.deprecated import that
from sure.six import PY3
from six import PY3

if PY3:
assert that("something").is_a(str)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
@@ -1,2 +1,3 @@
nose==1.3.0
rednose==0.4.1
six
4 changes: 2 additions & 2 deletions spec/reference.md
Expand Up @@ -243,7 +243,7 @@ exception:

```python
import sure
from sure.six import PY3
from six import PY3

if PY3:
range.when.called_with(10, step=20).should.throw(TypeError, "range() does not take keyword arguments")
Expand Down Expand Up @@ -296,7 +296,7 @@ this takes the class (type) itself and checks if the object is an instance of it

```python
import sure
from sure.six import PY3
from six import PY3

if PY3:
u"".should.be.an(str)
Expand Down
5 changes: 3 additions & 2 deletions sure/__init__.py
Expand Up @@ -27,6 +27,9 @@
from functools import wraps
from datetime import datetime

from six import string_types, text_type, PY3, get_function_code
from six.moves import reduce

from sure.old import AssertionHelper
from sure.old import Iterable
from sure.old import builtins
Expand All @@ -39,8 +42,6 @@

from sure.magic import is_cpython, patchable_builtin
from sure.registry import context as _registry
from sure.six import string_types, text_type, PY3, get_function_code
from sure.six.moves import reduce


if PY3:
Expand Down
29 changes: 29 additions & 0 deletions sure/compat_py3.py
@@ -0,0 +1,29 @@
import six

if six.PY3:
def compat_repr(object_repr):
return object_repr
else:
def compat_repr(object_repr):
# compat_repr is designed to return all reprs with leading 'u's
# inserted to make all strings look like unicode strings.
# This makes testing between py2 and py3 much easier.
result = ''
in_quote = False
curr_quote = None
for char in object_repr:
if char in ['"', "'"] and (
not curr_quote or char == curr_quote):
if in_quote:
# Closing quote
curr_quote = None
in_quote = False
else:
# Opening quote
curr_quote = char
result += 'u'
in_quote = True
result += char
return result

text_type_name = six.text_type().__class__.__name__
4 changes: 2 additions & 2 deletions sure/core.py
Expand Up @@ -24,11 +24,11 @@

import os
import inspect
from sure.terminal import red, green, yellow
from sure.six import (
from six import (
text_type, integer_types, string_types, binary_type,
PY3, get_function_code
)
from sure.terminal import red, green, yellow


class FakeOrderedDict(OrderedDict):
Expand Down
3 changes: 2 additions & 1 deletion sure/old.py
Expand Up @@ -33,11 +33,12 @@
except ImportError:
import builtins

from six import string_types, text_type

from sure.core import DeepComparison
from sure.core import _get_file_name
from sure.core import _get_line_number
from sure.core import itemize_length
from sure.six import string_types, text_type


def is_iterable(obj):
Expand Down

0 comments on commit 9fe8fd0

Please sign in to comment.