Skip to content

Commit

Permalink
Change the place of testing code
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-iskw committed Jul 15, 2015
1 parent d7a332a commit 28bd165
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions python/pyspark/mllib/clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,17 +565,6 @@ def predictOnValues(self, dstream):
return dstream.mapValues(lambda x: self._model.predict(x))


def _test():
import doctest
import pyspark.mllib.clustering
globs = pyspark.mllib.clustering.__dict__.copy()
globs['sc'] = SparkContext('local[4]', 'PythonTest', batchSize=2)
(failure_count, test_count) = doctest.testmod(globs=globs, optionflags=doctest.ELLIPSIS)
globs['sc'].stop()
if failure_count:
exit(-1)


class LDAModel(JavaModelWrapper):

""" A clustering model derived from the LDA method.
Expand Down Expand Up @@ -638,5 +627,16 @@ def train(cls, rdd, k=10, maxIterations=20, docConcentration=-1.0,
return LDAModel(model)


def _test():
import doctest
import pyspark.mllib.clustering
globs = pyspark.mllib.clustering.__dict__.copy()
globs['sc'] = SparkContext('local[4]', 'PythonTest', batchSize=2)
(failure_count, test_count) = doctest.testmod(globs=globs, optionflags=doctest.ELLIPSIS)
globs['sc'].stop()
if failure_count:
exit(-1)


if __name__ == "__main__":
_test()

0 comments on commit 28bd165

Please sign in to comment.