Skip to content

Commit

Permalink
Change python version definition.
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-golovanov committed Apr 9, 2017
1 parent 1b07125 commit e8bfbd5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_iterable(self):
'datetime': u"u'2016-12-06 11:22:33.444444'",
'unicode': u"u'пункт3'"
}
if unilog.compat.PY33:
if unilog.compat.PY3:
values = {k: v.replace('u', '') for k, v in values.items()}

self.assertEqual(
Expand Down Expand Up @@ -55,10 +55,10 @@ def test_mapping(self):
" '{}'\n"
" ]\n"
"}}".format(
generator, 'range(0, 10)' if unilog.compat.PY33 else 'xrange(10)'
generator, 'range(0, 10)' if unilog.compat.PY3 else 'xrange(10)'
)
)
if unilog.compat.PY33:
if unilog.compat.PY3:
result = result.encode(unilog.convert.LOCALE)

self.assertEqual(
Expand Down
14 changes: 7 additions & 7 deletions unilog/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import sys


PY33 = sys.version_info[0:2] >= (3, 3)
PY3 = sys.version_info.major >= 3


template = u"u'{}'"
UnicodeType = unicode
XRangeType = xrange

if PY33:
if PY3:
template = "'{}'"
UnicodeType= str
UnicodeType = str
XRangeType = range
else:
template = u"u'{}'"
UnicodeType = unicode
XRangeType = xrange

0 comments on commit e8bfbd5

Please sign in to comment.