| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,7 +58,22 @@ public void TestBufferRead() | |||
| 58 | 58 | } | |
| 59 | 59 | ||
| 60 | 60 | string result = new UTF8Encoding().GetString(managedArray); | |
| 61 | - Assert.That(result == " " + bufferTestString.Substring(1), Is.True); | ||
| 61 | + Assert.That(result, Is.EqualTo($" {bufferTestString.Substring(1)}")); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + [Test] | ||
| 65 | + public void GetPointer() | ||
| 66 | + { | ||
| 67 | + // create 3D NumPy array | ||
| 68 | + int[] shape = [10, 10, 10]; | ||
| 69 | + using PyObject ndArray = np.zeros(shape); | ||
| 70 | + | ||
| 71 | + using PyBuffer buf = ndArray.GetBuffer(PyBUF.STRIDES); | ||
| 72 | + | ||
| 73 | + // this throws System.ExecutionEngineException | ||
| 74 | + var ptr = buf.GetPointer([0, 0, 0]); | ||
| 75 | + | ||
| 76 | + Assert.That(ptr, Is.Not.EqualTo(IntPtr.Zero)); | ||
| 62 | 77 | } | |
| 63 | 78 | ||
| 64 | 79 | [Test] | |
| Back | FazBrowse Home | New Git URL |
0 commit comments