aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/search/query/profile
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-03-29 12:21:56 +0200
committerJon Bratseth <bratseth@gmail.com>2022-03-29 12:21:56 +0200
commite69d6e8f3d8a6504135f6d2733a3a42f6a041ed4 (patch)
tree046483fb628977f62a66cb660d4a09fcd4302e0d /container-search/src/test/java/com/yahoo/search/query/profile
parent13100e8dcc72b7c879727e5d96e1fdfceb2d3bcc (diff)
Validate query feature tensor types
- Validate tensor feature types when a tensor is set programmatically. - Add a toShortString for messages containing tensors. - Consistent and nicer spacing in tensor string forms.
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/query/profile')
-rw-r--r--container-search/src/test/java/com/yahoo/search/query/profile/types/test/QueryProfileTypeTestCase.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/query/profile/types/test/QueryProfileTypeTestCase.java b/container-search/src/test/java/com/yahoo/search/query/profile/types/test/QueryProfileTypeTestCase.java
index 20678f3b7bb..a77de954b3a 100644
--- a/container-search/src/test/java/com/yahoo/search/query/profile/types/test/QueryProfileTypeTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/query/profile/types/test/QueryProfileTypeTestCase.java
@@ -20,7 +20,6 @@ import com.yahoo.search.query.profile.types.FieldType;
import com.yahoo.search.query.profile.types.QueryProfileType;
import com.yahoo.search.query.profile.types.QueryProfileTypeRegistry;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import java.net.URLEncoder;
@@ -439,7 +438,6 @@ public class QueryProfileTypeTestCase {
}
@Test
- @Ignore
public void testTensorRankFeatureSetProgrammaticallyWithWrongType() {
QueryProfile profile = new QueryProfile("test");
profile.setType(testtype);
@@ -454,16 +452,18 @@ public class QueryProfileTypeTestCase {
fail("Expected exception");
}
catch (IllegalArgumentException e) {
- assertEquals("'query(myTensor1)' must be of type tensor(a{},b{}) but was of type tensor(x[3])",
- e.getMessage());
+ assertEquals("Could not set 'ranking.features.query(myTensor1)' to 'tensor(x[3]):[0.1, 0.2, 0.3]': " +
+ "Require a tensor of type tensor(a{},b{})",
+ Exceptions.toMessageString(e));
}
try {
query.properties().set("ranking.features.query(myTensor1)", Tensor.from(tensorString));
fail("Expected exception");
}
catch (IllegalArgumentException e) {
- assertEquals("'query(myTensor1)' must be of type tensor(a{},b{}) but was of type tensor(x[3])",
- e.getMessage());
+ assertEquals("Could not set 'ranking.features.query(myTensor1)' to 'tensor(x[3]):[0.1, 0.2, 0.3]': " +
+ "Require a tensor of type tensor(a{},b{})",
+ Exceptions.toMessageString(e));
}
}