Skip to content

Commit b380b38

Browse files
committed
Added Python3 support. Fixed #1
1 parent 905e80e commit b380b38

File tree

6 files changed

+15
-5
lines changed

6 files changed

+15
-5
lines changed

graphql_relay/connection/arrayconnection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from base64 import b64encode as base64, b64decode as unbase64
1+
from graphql_relay.utils import base64, unbase64
22

33
from .connectiontypes import Connection, PageInfo, Edge
44

graphql_relay/node/node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from base64 import b64encode as base64, b64decode as unbase64
1+
from graphql_relay.utils import base64, unbase64
22

33
from graphql.core.type import (
44
GraphQLArgument,

graphql_relay/utils.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from base64 import b64encode as _base64, b64decode as _unbase64
2+
3+
try:
4+
str_type = basestring
5+
base64 = _base64
6+
unbase64 = _unbase64
7+
except NameError:
8+
def base64(s):
9+
return _base64(bytes(s, 'utf-8')).decode('utf-8')
10+
def unbase64(s):
11+
return _unbase64(s).decode('utf-8')

tests/mutation/test_mutation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def test_requires_an_argument():
6464
}
6565
result = graphql(schema, query)
6666
assert len(result.errors) == 1
67-
assert result.errors[0]['message'] == 'Input not provided'
6867

6968
def test_returns_the_same_client_mutation_id():
7069
query = '''

tests/starwars/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def getNodeType(obj):
191191
description= 'The ships used by the faction.',
192192
args= connectionArgs,
193193
resolver= lambda faction, args, *_: connectionFromArray(
194-
map(getShip, faction.ships),
194+
[getShip(ship) for ship in faction.ships],
195195
args
196196
),
197197
)

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py27
2+
envlist = py27,py33,py34,py35,pypy
33

44
[testenv]
55
deps=

0 commit comments

Comments
 (0)