Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
beem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
beem
Commits
fde33e6f
Commit
fde33e6f
authored
7 years ago
by
Holger Nahrstaedt
Browse files
Options
Downloads
Patches
Plain Diff
Fix unittest for python 3
parent
3c4d42a4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
beemgraphenebase/base58.py
+2
-2
2 additions, 2 deletions
beemgraphenebase/base58.py
beemgraphenebase/py23.py
+8
-1
8 additions, 1 deletion
beemgraphenebase/py23.py
tests/beemgraphene/test_py23.py
+7
-2
7 additions, 2 deletions
tests/beemgraphene/test_py23.py
with
17 additions
and
5 deletions
beemgraphenebase/base58.py
+
2
−
2
View file @
fde33e6f
...
...
@@ -8,7 +8,7 @@ from builtins import object
from
builtins
import
chr
from
future.utils
import
python_2_unicode_compatible
from
binascii
import
hexlify
,
unhexlify
from
.py23
import
py23_bytes
,
bytes_types
,
integer_types
,
string_types
,
text_type
from
.py23
import
py23_bytes
,
py23_chr
,
bytes_types
,
integer_types
,
string_types
,
text_type
import
hashlib
import
sys
import
string
...
...
@@ -124,7 +124,7 @@ def base58decode(base58_str):
leading_zeroes_count
=
0
for
b
in
base58_text
:
if
isinstance
(
b
,
integer_types
):
n
=
n
*
58
+
BASE58_ALPHABET
.
find
(
chr
(
b
))
n
=
n
*
58
+
BASE58_ALPHABET
.
find
(
py23_
chr
(
b
))
else
:
n
=
n
*
58
+
BASE58_ALPHABET
.
find
(
b
)
if
n
==
0
:
...
...
This diff is collapsed.
Click to expand it.
beemgraphenebase/py23.py
+
8
−
1
View file @
fde33e6f
...
...
@@ -2,7 +2,7 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
from
__future__
import
unicode_literals
from
builtins
import
bytes
,
int
,
str
from
builtins
import
bytes
,
int
,
str
,
chr
import
sys
PY2
=
sys
.
version_info
[
0
]
==
2
...
...
@@ -31,3 +31,10 @@ def py23_bytes(item, encoding=None):
return
bytes
(
item
,
encoding
)
else
:
return
bytes
(
item
)
def
py23_chr
(
item
):
if
PY2
:
return
chr
(
item
)
else
:
return
bytes
([
item
])
This diff is collapsed.
Click to expand it.
tests/beemgraphene/test_py23.py
+
7
−
2
View file @
fde33e6f
...
...
@@ -7,6 +7,7 @@ import pytest
import
unittest
from
beemgraphenebase.py23
import
(
py23_bytes
,
py23_chr
,
bytes_types
,
integer_types
,
string_types
,
...
...
@@ -105,10 +106,14 @@ class Testcases(unittest.TestCase):
def
test_string_types
(
self
):
a
=
'
abc
'
b
=
u
'
abc
'
c
=
b
'
abc
'
self
.
assertTrue
(
isinstance
(
a
,
string_types
))
self
.
assertTrue
(
isinstance
(
b
,
string_types
))
self
.
assertTrue
(
isinstance
(
c
,
string_types
))
def
test_chr
(
self
):
BASE58_ALPHABET
=
b
"
123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
"
self
.
assertEqual
(
BASE58_ALPHABET
.
find
(
py23_chr
(
4
)),
-
1
)
self
.
assertEqual
(
BASE58_ALPHABET
.
find
(
b
"
Z
"
),
32
)
self
.
assertEqual
(
BASE58_ALPHABET
.
find
(
py23_bytes
(
"
Z
"
,
"
ascii
"
)),
32
)
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment