Skip to content

Commit

Permalink
fix tests in python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Davies Liu committed Apr 19, 2015
1 parent d17d634 commit eb4fa53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion python/pyspark/java_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@

import atexit
import os
import sys
import select
import signal
import shlex
import socket
import platform
from subprocess import Popen, PIPE

if sys.version >= '3':
xrange = range

from py4j.java_gateway import java_import, JavaGateway, GatewayClient
from py4j.java_collections import ListConverter

Expand All @@ -32,7 +36,7 @@

# patching ListConverter, or it will convert bytearray into Java ArrayList
def can_convert_list(self, obj):
return isinstance(obj, (list, tuple))
return isinstance(obj, (list, tuple, xrange))

ListConverter.can_convert = can_convert_list

Expand Down
2 changes: 1 addition & 1 deletion python/pyspark/sql/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def test_infer_long_type(self):
self.assertEqual(_infer_type(2**71), LongType())

def test_filter_with_datetime(self):
time = datetime.datetime(2015, 4, 17, 23, 01, 02, 3000)
time = datetime.datetime(2015, 4, 17, 23, 1, 2, 3000)
date = time.date()
row = Row(date=date, time=time)
df = self.sqlCtx.createDataFrame([row])
Expand Down

0 comments on commit eb4fa53

Please sign in to comment.