You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2018/01/17 22:31:01 UTC
spark git commit: [SPARK-23132][PYTHON][ML] Run doctests in ml.image
when testing
Repository: spark
Updated Branches:
refs/heads/master 4e6f8fb15 -> 45ad97df8
[SPARK-23132][PYTHON][ML] Run doctests in ml.image when testing
## What changes were proposed in this pull request?
This PR proposes to actually run the doctests in `ml/image.py`.
## How was this patch tested?
doctests in `python/pyspark/ml/image.py`.
Author: hyukjinkwon <gu...@gmail.com>
Closes #20294 from HyukjinKwon/trigger-image.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/45ad97df
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/45ad97df
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/45ad97df
Branch: refs/heads/master
Commit: 45ad97df87c89cb94ce9564e5773897b6d9326f5
Parents: 4e6f8fb
Author: hyukjinkwon <gu...@gmail.com>
Authored: Thu Jan 18 07:30:54 2018 +0900
Committer: hyukjinkwon <gu...@gmail.com>
Committed: Thu Jan 18 07:30:54 2018 +0900
----------------------------------------------------------------------
python/pyspark/ml/image.py | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/45ad97df/python/pyspark/ml/image.py
----------------------------------------------------------------------
diff --git a/python/pyspark/ml/image.py b/python/pyspark/ml/image.py
index c9b8402..2d86c7f 100644
--- a/python/pyspark/ml/image.py
+++ b/python/pyspark/ml/image.py
@@ -194,9 +194,9 @@ class _ImageSchema(object):
:return: a :class:`DataFrame` with a single column of "images",
see ImageSchema for details.
- >>> df = ImageSchema.readImages('python/test_support/image/kittens', recursive=True)
+ >>> df = ImageSchema.readImages('data/mllib/images/kittens', recursive=True)
>>> df.count()
- 4
+ 5
.. versionadded:: 2.3.0
"""
@@ -216,3 +216,25 @@ ImageSchema = _ImageSchema()
def _disallow_instance(_):
raise RuntimeError("Creating instance of _ImageSchema class is disallowed.")
_ImageSchema.__init__ = _disallow_instance
+
+
+def _test():
+ import doctest
+ import pyspark.ml.image
+ globs = pyspark.ml.image.__dict__.copy()
+ spark = SparkSession.builder\
+ .master("local[2]")\
+ .appName("ml.image tests")\
+ .getOrCreate()
+ globs['spark'] = spark
+
+ (failure_count, test_count) = doctest.testmod(
+ pyspark.ml.image, globs=globs,
+ optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE)
+ spark.stop()
+ if failure_count:
+ exit(-1)
+
+
+if __name__ == "__main__":
+ _test()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org