(t *testing.T)
| 36 | } |
| 37 | |
| 38 | func TestAddOperationFailure(t *testing.T) { |
| 39 | // Inspired from https://github.com/tensorflow/tensorflow/issues/9931 |
| 40 | s := NewScope() |
| 41 | |
| 42 | resize := ResizeArea(s, Placeholder(s, tf.Float), Const(s, []int64{80, 80})) |
| 43 | if err := s.Err(); err == nil { |
| 44 | t.Fatal("ResizeArea expects an int32 Tensor for size, should fail when an int64 is provided") |
| 45 | } |
| 46 | // And any use of resize should panic with an error message more informative than SIGSEGV |
| 47 | defer func() { |
| 48 | r := recover() |
| 49 | if r == nil { |
| 50 | return |
| 51 | } |
| 52 | s, ok := r.(string) |
| 53 | if ok && strings.Contains(s, "see Scope.Err() for details") { |
| 54 | return |
| 55 | } |
| 56 | t.Errorf("Expected panic string to Scope.Err(), found %T: %q", r, r) |
| 57 | }() |
| 58 | _ = resize.Shape() |
| 59 | t.Errorf("resize.Shape() should have paniced since the underlying Operation was not created") |
| 60 | } |
| 61 | |
| 62 | func TestShapeAttribute(t *testing.T) { |
| 63 | s := NewScope() |
nothing calls this directly
no test coverage detected