| 53 | } |
| 54 | |
| 55 | func TestScopeSubScopeErrors(t *testing.T) { |
| 56 | var ( |
| 57 | root = NewScope() |
| 58 | sub = root.SubScope("x") |
| 59 | ) |
| 60 | // Error on the root, even after sub has been created should be propagated. |
| 61 | // Force an error by creating a Const which has a type that does not |
| 62 | // translate to the TensorFlow type system. |
| 63 | Const(root, int(1)) |
| 64 | if err := root.Err(); err == nil { |
| 65 | t.Fatal("Expected error") |
| 66 | } |
| 67 | if err := sub.Err(); err == nil { |
| 68 | t.Errorf("Root scope had error [%v], but sub-scope did not", root.Err()) |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | func TestControlDependencies(t *testing.T) { |
| 73 | var ( |