Skip to content

Commit b6755cc

Browse files
BanycOceania2018
authored andcommitted
Add test case TypeMismatchedSliceAssign
1 parent 8350969 commit b6755cc

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/TensorFlowNET.UnitTest/Basics/VariableTest.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,26 @@ public void SliceAssign()
8383
Assert.AreEqual(nd[2], x[2].numpy());
8484
}
8585

86+
[TestMethod, Ignore]
87+
public void TypeMismatchedSliceAssign()
88+
{
89+
NDArray intNd = new int[]
90+
{
91+
1, -2, 3
92+
};
93+
NDArray doubleNd = new double[]
94+
{
95+
-5, 6, -7
96+
};
97+
var x = tf.Variable(doubleNd);
98+
99+
var slice = x[":"];
100+
Assert.ThrowsException<System.Exception>(
101+
// this statement exit without throwing any exception but the "test execution summary" seems not able to detect that.
102+
() => slice.assign(intNd)
103+
);
104+
}
105+
86106
[TestMethod]
87107
public void Accumulation()
88108
{

0 commit comments

Comments
 (0)