You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by imatiach-msft <gi...@git.apache.org> on 2018/02/12 05:18:13 UTC
[GitHub] spark pull request #20583: [SPARK-23392][TEST] Add some test cases for image...
Github user imatiach-msft commented on a diff in the pull request:
https://github.com/apache/spark/pull/20583#discussion_r167470275
--- Diff: mllib/src/test/scala/org/apache/spark/ml/image/ImageSchemaSuite.scala ---
@@ -65,11 +65,71 @@ class ImageSchemaSuite extends SparkFunSuite with MLlibTestSparkContext {
assert(count50 > 0 && count50 < countTotal)
}
+ test("readImages test: recursive = false") {
+ val df = readImages(imagePath, null, false, 3, true, 1.0, 0)
+ assert(df.count() === 0)
+ }
+
+ test("readImages test: read jpg image") {
+ val df = readImages(imagePath + "/kittens/DP153539.jpg", null, false, 3, true, 1.0, 0)
+ assert(df.count() === 1)
+ }
+
+ test("readImages test: read png image") {
+ val df = readImages(imagePath + "/multi-channel/BGRA.png", null, false, 3, true, 1.0, 0)
+ assert(df.count() === 1)
+ }
+
+ test("readImages test: read non image") {
+ val df = readImages(imagePath + "/kittens/not-image.txt", null, false, 3, true, 1.0, 0)
+ assert(df.count() === 0)
+ }
+
+ test("readImages test: read non image and dropImageFailures is false") {
+ val df = readImages(imagePath + "/kittens/not-image.txt", null, false, 3, false, 1.0, 0)
+ assert(df.count() === 1)
--- End diff --
(optional) you can also validate here that the entry has the correct structure for an invalid image
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org