aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/java/src/test/java/org/tensorflow/op/ScopeTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/java/src/test/java/org/tensorflow/op/ScopeTest.java')
-rw-r--r--tensorflow/java/src/test/java/org/tensorflow/op/ScopeTest.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/tensorflow/java/src/test/java/org/tensorflow/op/ScopeTest.java b/tensorflow/java/src/test/java/org/tensorflow/op/ScopeTest.java
index 125de73554..2057007499 100644
--- a/tensorflow/java/src/test/java/org/tensorflow/op/ScopeTest.java
+++ b/tensorflow/java/src/test/java/org/tensorflow/op/ScopeTest.java
@@ -17,10 +17,12 @@ package org.tensorflow.op;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.HashMap;
import java.util.Map;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@@ -181,6 +183,21 @@ public class ScopeTest {
assertEquals(21704, result.intValue());
}
}
+
+ @Test
+ public void prefix() {
+ try (Graph g = new Graph()) {
+ Scope s = new Scope(g);
+ assertNotNull(s.prefix());
+ assertTrue(s.prefix().isEmpty());
+
+ Scope sub1 = s.withSubScope("sub1");
+ assertEquals("sub1", sub1.prefix());
+
+ Scope sub2 = sub1.withSubScope("sub2");
+ assertEquals("sub1/sub2", sub2.prefix());
+ }
+ }
// "handwritten" sample operator classes
private static final class Const<T> {