forked from SciSharp/TensorFlow.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPythonBaseTests.cs
More file actions
54 lines (48 loc) · 1.61 KB
/
PythonBaseTests.cs
File metadata and controls
54 lines (48 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tensorflow;
using static Tensorflow.Binding;
namespace TensorFlowNET.UnitTest
{
[TestClass]
public class PythonBaseTests : PythonTest
{
[Ignore]
[TestMethod]
public void weakKeyDictionary_test()
{
var weakKeyDict = new WeakKeyDictionary<int, char>();
for (int i = 0; i < 5; i++)
{
var c = (char)((int)'a' + i);
weakKeyDict[i] = c;
//Assert.AreEqual(weakKeyDict.Count, (int)(i + 1));
var v = (weakKeyDict.Count == i + 1);
Assert.IsTrue(v);
}
//Assert.AreEqual(weakKeyDict.Count, 0);
var b = (weakKeyDict.Count == 0);
Assert.IsTrue(b);
}
[TestMethod]
public void isinstance_test()
{
var s1 = "hi";
var s2 = "hello";
var t1 = (s1, s2);
var t2 = (s1, s2, s1);
var t3 = (s2, s1);
var true1 = isinstance(s1, typeof(string));
var false1 = isinstance(t1, typeof(string));
var true2 = isinstance(t1, t3.GetType());
var false2 = isinstance(t1, t2.GetType());
var true3 = isinstance(t1, (t2.GetType(), t1.GetType(), typeof(string)));
var false3 = isinstance(t3, (t2.GetType(), typeof(string)));
Assert.IsTrue(true1);
Assert.IsTrue(true2);
Assert.IsTrue(true3);
Assert.IsFalse(false1);
Assert.IsFalse(false2);
Assert.IsFalse(false3);
}
}
}