Skip to content

Commit 30b837a

Browse files
author
Matthew Farrellee
committed
Combine test cases to save on JVM startups
1 parent 6bc4a2c commit 30b837a

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

python/pyspark/tests.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -587,12 +587,9 @@ def test_repartitionAndSortWithinPartitions(self):
587587
self.assertEquals(partitions[1], [(1, 3), (3, 8), (3, 8)])
588588

589589
def test_distinct(self):
590-
rdd = self.sc.parallelize((1, 2, 3)*10).distinct()
591-
self.assertEquals(rdd.count(), 3)
592-
593-
def test_distinct_numPartitions(self):
594590
rdd = self.sc.parallelize((1, 2, 3)*10, 10)
595591
self.assertEquals(rdd.getNumPartitions(), 10)
592+
self.assertEquals(rdd.distinct().count(), 3)
596593
result = rdd.distinct(5)
597594
self.assertEquals(result.getNumPartitions(), 5)
598595
self.assertEquals(result.count(), 3)
@@ -647,14 +644,10 @@ def test_basic_functions(self):
647644
srdd.collect()
648645

649646
def test_distinct(self):
650-
rdd = self.sc.parallelize(['{"a": 1}', '{"b": 2}', '{"c": 3}']*10)
651-
srdd = self.sqlCtx.jsonRDD(rdd).distinct()
652-
self.assertEquals(srdd.count(), 3)
653-
654-
def test_distinct_numPartitions(self):
655647
rdd = self.sc.parallelize(['{"a": 1}', '{"b": 2}', '{"c": 3}']*10, 10)
656648
srdd = self.sqlCtx.jsonRDD(rdd)
657649
self.assertEquals(srdd.getNumPartitions(), 10)
650+
self.assertEquals(srdd.distinct().count(), 3)
658651
result = srdd.distinct(5)
659652
self.assertEquals(result.getNumPartitions(), 5)
660653
self.assertEquals(result.count(), 3)

0 commit comments

Comments
 (0)