-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sorting to Dense vector check (#148)
- Loading branch information
Showing
3 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/test/scala/com/linkedin/feathr/offline/util/TestCoercionUtilsScala.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.linkedin.feathr.offline.util | ||
|
||
import com.linkedin.feathr.common | ||
import com.linkedin.feathr.offline.util.CoercionUtilsScala.coerceFeatureValueToStringKey | ||
import org.testng.Assert.assertEquals | ||
import org.testng.annotations.Test | ||
|
||
import scala.util.Random.shuffle | ||
import scala.collection.JavaConverters._ | ||
|
||
class TestCoercionUtilsScala { | ||
@Test(description = "Verifies that coerceFeatureValueToStringKey works properly for unordered NTV values") | ||
def testFDSTensorSchemas(): Unit = { | ||
val inputNTV = shuffle(List.range(0, 50).map(_.toString).zipWithIndex).map(kv => (kv._1, kv._2.toFloat)).toMap | ||
val stringKey = coerceFeatureValueToStringKey(new common.FeatureValue(inputNTV.asJava)) | ||
assertEquals(stringKey.toList, List.range(0, 50).map(_.toString)) | ||
} | ||
|
||
} |