Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/7447#discussion_r36212894
--- Diff:
mllib/src/test/scala/org/apache/spark/ml/classification/DecisionTreeClassifierSuite.scala
---
@@ -232,6 +232,13 @@ class DecisionTreeClassifierSuite extends
SparkFunSuite with MLlibTestSparkConte
compareAPIs(rdd, dt, categoricalFeatures = Map.empty[Int, Int],
numClasses)
}
+ test("copied model must have the same parent") {
--- End diff --
I don't think you need to write a new unit test for each model. A more
efficient way would be to write a generic testing utility like this (maybe
inside a new file like
test/scala/org/apache/spark/ml/util/MLTestingUtils.scala):
```
object MLTestingUtils {
def checkCopy(model: Model[_]): Unit = {
val copied = model.copy()
assert(copied.parent === model.parent)
}
}
```
Later on, we can add other standard checks here as well.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]