| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,7 @@ | |||
| 4 | 4 | <AssemblyCopyright>Copyright (c) 2006-2025 The Contributors of the Python.NET Project</AssemblyCopyright> | |
| 5 | 5 | <AssemblyCompany>pythonnet</AssemblyCompany> | |
| 6 | 6 | <AssemblyProduct>Python.NET</AssemblyProduct> | |
| 7 | - <LangVersion>12.0</LangVersion> | ||
| 7 | + <LangVersion>14</LangVersion> | ||
| 8 | 8 | <IsPackable>false</IsPackable> | |
| 9 | 9 | <DeterministicSourcePaths>true</DeterministicSourcePaths> | |
| 10 | 10 | <FullVersion>$([System.IO.File]::ReadAllText("$(MSBuildThisFileDirectory)version.txt").Trim())</FullVersion> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,7 +32,7 @@ static void TupleConversionsGeneric<T, TTuple>() | |||
| 32 | 32 | scope.Set(nameof(tuple), tuple); | |
| 33 | 33 | scope.Set(nameof(accept), accept); | |
| 34 | 34 | scope.Exec($"{nameof(accept)}({nameof(tuple)})"); | |
| 35 | - Assert.AreEqual(expected: tuple, actual: restored); | ||
| 35 | + Assert.That(actual: restored, Is.EqualTo(expected: tuple)); | ||
| 36 | 36 | } | |
| 37 | 37 | } | |
| 38 | 38 | ||
@@ -53,7 +53,7 @@ static void TupleConversionsObject<T, TTuple>() | |||
| 53 | 53 | scope.Set(nameof(tuple), tuple); | |
| 54 | 54 | scope.Set(nameof(accept), accept); | |
| 55 | 55 | scope.Exec($"{nameof(accept)}({nameof(tuple)})"); | |
| 56 | - Assert.AreEqual(expected: tuple, actual: restored); | ||
| 56 | + Assert.That(actual: restored, Is.EqualTo(expected: tuple)); | ||
| 57 | 57 | } | |
| 58 | 58 | } | |
| 59 | 59 | ||
@@ -67,7 +67,7 @@ static void TupleRoundtripObject<T, TTuple>() | |||
| 67 | 67 | var tuple = Activator.CreateInstance(typeof(T), 42.0, "42", new object()); | |
| 68 | 68 | using var pyTuple = TupleCodec<TTuple>.Instance.TryEncode(tuple); | |
| 69 | 69 | Assert.IsTrue(TupleCodec<TTuple>.Instance.TryDecode(pyTuple, out object restored)); | |
| 70 | - Assert.AreEqual(expected: tuple, actual: restored); | ||
| 70 | + Assert.That(actual: restored, Is.EqualTo(expected: tuple)); | ||
| 71 | 71 | } | |
| 72 | 72 | ||
| 73 | 73 | [Test] | |
@@ -81,7 +81,7 @@ static void TupleRoundtripGeneric<T, TTuple>() | |||
| 81 | 81 | var tuple = Activator.CreateInstance(typeof(T), 42, "42", new object()); | |
| 82 | 82 | using var pyTuple = TupleCodec<TTuple>.Instance.TryEncode(tuple); | |
| 83 | 83 | Assert.IsTrue(TupleCodec<TTuple>.Instance.TryDecode(pyTuple, out T restored)); | |
| 84 | - Assert.AreEqual(expected: tuple, actual: restored); | ||
| 84 | + Assert.That(actual: restored, Is.EqualTo(expected: tuple)); | ||
| 85 | 85 | } | |
| 86 | 86 | ||
| 87 | 87 | static PyObject GetPythonIterable() => PythonEngine.Eval("map(lambda x: x, [1,2,3])"); | |
@@ -118,7 +118,7 @@ public void ListDecoderTest() | |||
| 118 | 118 | //the IList will report a Count of 3. | |
| 119 | 119 | IList<string> stringList = null; | |
| 120 | 120 | Assert.DoesNotThrow(() => { codec.TryDecode(pyList, out stringList); }); | |
| 121 | - Assert.AreEqual(stringList.Count, 3); | ||
| 121 | + Assert.That(3, Is.EqualTo(stringList.Count)); | ||
| 122 | 122 | Assert.Throws(typeof(InvalidCastException), () => { var x = stringList[0]; }); | |
| 123 | 123 | ||
| 124 | 124 | //can't convert python iterable to list (this will require a copy which isn't lossless) | |
@@ -162,8 +162,8 @@ public void SequenceDecoderTest() | |||
| 162 | 162 | //the IList will report a Count of 3. | |
| 163 | 163 | ICollection<string> stringCollection = null; | |
| 164 | 164 | Assert.DoesNotThrow(() => { codec.TryDecode(pyList, out stringCollection); }); | |
| 165 | - Assert.AreEqual(3, stringCollection.Count()); | ||
| 166 | - Assert.Throws(typeof(InvalidCastException), () => { | ||
| 165 | + Assert.That(stringCollection.Count(), Is.EqualTo(3)); | ||
| 166 | + Assert.Throws<InvalidCastException>(() => { | ||
| 167 | 167 | string[] array = new string[3]; | |
| 168 | 168 | stringCollection.CopyTo(array, 0); | |
| 169 | 169 | }); | |
@@ -199,8 +199,8 @@ public void SequenceDecoderTest() | |||
| 199 | 199 | //the IList will report a Count of 3. | |
| 200 | 200 | ICollection<string> stringCollection2 = null; | |
| 201 | 201 | Assert.DoesNotThrow(() => { codec.TryDecode(pyTuple, out stringCollection2); }); | |
| 202 | - Assert.AreEqual(3, stringCollection2.Count()); | ||
| 203 | - Assert.Throws(typeof(InvalidCastException), () => { | ||
| 202 | + Assert.That(stringCollection2.Count, Is.EqualTo(3)); | ||
| 203 | + Assert.Throws<InvalidCastException>(() => { | ||
| 204 | 204 | string[] array = new string[3]; | |
| 205 | 205 | stringCollection2.CopyTo(array, 0); | |
| 206 | 206 | }); | |
@@ -321,7 +321,7 @@ def call(func): | |||
| 321 | 321 | "); | |
| 322 | 322 | var callFunc = scope.Get("call"); | |
| 323 | 323 | string message = callFunc.Invoke(callMeAction.ToPython()).As<string>(); | |
| 324 | - Assert.AreEqual(TestExceptionMessage, message); | ||
| 324 | + Assert.That(message, Is.EqualTo(TestExceptionMessage)); | ||
| 325 | 325 | } | |
| 326 | 326 | ||
| 327 | 327 | [Test] | |
@@ -331,7 +331,7 @@ public void ExceptionDecoded() | |||
| 331 | 331 | using var scope = Py.CreateScope(); | |
| 332 | 332 | var error = Assert.Throws<ValueErrorWrapper>(() | |
| 333 | 333 | => PythonEngine.Exec($"raise ValueError('{TestExceptionMessage}')")); | |
| 334 | - Assert.AreEqual(TestExceptionMessage, error.Message); | ||
| 334 | + Assert.That(error.Message, Is.EqualTo(TestExceptionMessage)); | ||
| 335 | 335 | } | |
| 336 | 336 | ||
| 337 | 337 | [Test] | |
@@ -360,7 +360,7 @@ public void FloatDerivedDecoded() | |||
| 360 | 360 | PyObjectConversions.RegisterDecoder(decoder); | |
| 361 | 361 | using var result = scope.Eval("FloatDerived()"); | |
| 362 | 362 | object decoded = result.As<object>(); | |
| 363 | - Assert.AreEqual(42, decoded); | ||
| 363 | + Assert.That(decoded, Is.EqualTo(42)); | ||
| 364 | 364 | } | |
| 365 | 365 | ||
| 366 | 366 | [Test] | |
@@ -374,7 +374,7 @@ public void ExceptionDecodedNoInstance() | |||
| 374 | 374 | var error = Assert.Throws<ValueErrorWrapper>(() => | |
| 375 | 375 | PythonEngine.Exec($"[].__iter__().__next__()") | |
| 376 | 376 | ); | |
| 377 | - Assert.AreEqual(TestExceptionMessage, error.Message); | ||
| 377 | + Assert.That(error.Message, Is.EqualTo(TestExceptionMessage)); | ||
| 378 | 378 | } | |
| 379 | 379 | else | |
| 380 | 380 | { | |
@@ -395,7 +395,7 @@ public void As_Object_AffectedByDecoders() | |||
| 395 | 395 | ||
| 396 | 396 | var pyObj = PythonEngine.Eval("iter"); | |
| 397 | 397 | var decoded = pyObj.As<object>(); | |
| 398 | - Assert.AreSame(everythingElseToSelf, decoded); | ||
| 398 | + Assert.That(decoded, Is.SameAs(everythingElseToSelf)); | ||
| 399 | 399 | } | |
| 400 | 400 | ||
| 401 | 401 | public class EverythingElseToSelfDecoder : IPyObjectDecoder | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,12 +19,12 @@ public void AssignObject() | |||
| 19 | 19 | sys.testattr = stream; | |
| 20 | 20 | // Check whether there are the same object. | |
| 21 | 21 | dynamic _stream = sys.testattr.AsManagedObject(typeof(StringBuilder)); | |
| 22 | - Assert.AreEqual(_stream, stream); | ||
| 22 | + Assert.That(_stream, Is.EqualTo(stream)); | ||
| 23 | 23 | ||
| 24 | 24 | PythonEngine.RunSimpleString( | |
| 25 | 25 | "import sys\n" + | |
| 26 | 26 | "sys.testattr.Append('Hello!')\n"); | |
| 27 | - Assert.AreEqual(stream.ToString(), "Hello!"); | ||
| 27 | + Assert.That(stream.ToString(), Is.EqualTo("Hello!")); | ||
| 28 | 28 | } | |
| 29 | 29 | ||
| 30 | 30 | /// <summary> | |
@@ -45,25 +45,15 @@ public void AssignNone() | |||
| 45 | 45 | /// Check whether we can get the attr of a python object when the | |
| 46 | 46 | /// value of attr is a PyObject. | |
| 47 | 47 | /// </summary> | |
| 48 | - /// <remarks> | ||
| 49 | - /// FIXME: Issue on Travis PY27: Error : Python.EmbeddingTest.dynamicTest.AssignPyObject | ||
| 50 | - /// Python.Runtime.PythonException : ImportError : /home/travis/virtualenv/python2.7.9/lib/python2.7/lib-dynload/_io.so: undefined symbol: _PyLong_AsInt | ||
| 51 | - /// </remarks> | ||
| 52 | 48 | [Test] | |
| 53 | 49 | public void AssignPyObject() | |
| 54 | 50 | { | |
| 55 | - if (Environment.GetEnvironmentVariable("TRAVIS") == "true" && | ||
| 56 | - Environment.GetEnvironmentVariable("TRAVIS_PYTHON_VERSION") == "2.7") | ||
| 57 | - { | ||
| 58 | - Assert.Ignore("Fails on Travis/PY27: ImportError: ... undefined symbol: _PyLong_AsInt"); | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | 51 | dynamic sys = Py.Import("sys"); | |
| 62 | 52 | dynamic io = Py.Import("io"); | |
| 63 | 53 | sys.testattr = io.StringIO(); | |
| 64 | 54 | dynamic bb = sys.testattr; // Get the PyObject | |
| 65 | 55 | bb.write("Hello!"); | |
| 66 | - Assert.AreEqual(bb.getvalue().ToString(), "Hello!"); | ||
| 56 | + Assert.That(bb.getvalue().ToString(), Is.EqualTo("Hello!")); | ||
| 67 | 57 | } | |
| 68 | 58 | ||
| 69 | 59 | /// <summary> | |
@@ -87,7 +77,7 @@ public void PassObjectInPython() | |||
| 87 | 77 | "import sys\n" + | |
| 88 | 78 | "sys.testattr3 = sys.testattr1 is sys.testattr2\n" | |
| 89 | 79 | ); | |
| 90 | - Assert.AreEqual(sys.testattr3.ToString(), "True"); | ||
| 80 | + Assert.That(sys.testattr3.ToString(), Is.EqualTo("True")); | ||
| 91 | 81 | ||
| 92 | 82 | // Compare in .NET | |
| 93 | 83 | Assert.IsTrue(sys.testattr1.Equals(sys.testattr2)); | |
@@ -110,7 +100,7 @@ public void PassPyObjectInNet() | |||
| 110 | 100 | "sys.testattr3 = sys.testattr1 is sys.testattr2\n" | |
| 111 | 101 | ); | |
| 112 | 102 | ||
| 113 | - Assert.AreEqual(sys.testattr3.ToString(), "True"); | ||
| 103 | + Assert.That(sys.testattr3.ToString(), Is.EqualTo("True")); | ||
| 114 | 104 | ||
| 115 | 105 | // Compare in .NET | |
| 116 | 106 | Assert.IsTrue(sys.testattr1.Equals(sys.testattr2)); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,7 +31,7 @@ del example | |||
| 31 | 31 | gc.collect() | |
| 32 | 32 | "); | |
| 33 | 33 | Runtime.Runtime.TryCollectingGarbage(10); | |
| 34 | - Assert.AreEqual(0, ClassWithEventHandler.alive); | ||
| 34 | + Assert.That(ClassWithEventHandler.alive, Is.EqualTo(0)); | ||
| 35 | 35 | } | |
| 36 | 36 | } | |
| 37 | 37 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -149,11 +149,11 @@ public void TestScopeClass() | |||
| 149 | 149 | ); | |
| 150 | 150 | dynamic obj1 = _ps.Class1(20); | |
| 151 | 151 | var result = obj1.call(10).As<int>(); | |
| 152 | - Assert.AreEqual(130, result); | ||
| 152 | + Assert.That(result, Is.EqualTo(130)); | ||
| 153 | 153 | ||
| 154 | 154 | obj1.update(10); | |
| 155 | 155 | result = ps.Get<int>("bb"); | |
| 156 | - Assert.AreEqual(30, result); | ||
| 156 | + Assert.That(result, Is.EqualTo(30)); | ||
| 157 | 157 | } | |
| 158 | 158 | } | |
| 159 | 159 | ||
@@ -185,11 +185,11 @@ public void TestCreateVirtualPackageStructure() | |||
| 185 | 185 | ||
| 186 | 186 | dynamic obj1 = ps2.Class1(20); | |
| 187 | 187 | var result = obj1.call(10).As<int>(); | |
| 188 | - Assert.AreEqual(130, result); | ||
| 188 | + Assert.That(result, Is.EqualTo(130)); | ||
| 189 | 189 | ||
| 190 | 190 | obj1.update(10); | |
| 191 | 191 | result = ps2.Get<int>("bb"); | |
| 192 | - Assert.AreEqual(30, result); | ||
| 192 | + Assert.That(result, Is.EqualTo(30)); | ||
| 193 | 193 | } | |
| 194 | 194 | } | |
| 195 | 195 | ||
@@ -229,7 +229,7 @@ public void TestImportModule() | |||
| 229 | 229 | var value1 = ps.Eval<int>("sys.attr1"); | |
| 230 | 230 | var value2 = sys.attr1.As<int>(); | |
| 231 | 231 | Assert.That(value1, Is.EqualTo(2)); | |
| 232 | - Assert.AreEqual(2, value2); | ||
| 232 | + Assert.That(value2, Is.EqualTo(2)); | ||
| 233 | 233 | ||
| 234 | 234 | //import as | |
| 235 | 235 | ps.Import("sys", "sys1"); | |
@@ -308,16 +308,16 @@ public void TestImportScopeFunction() | |||
| 308 | 308 | dynamic func2 = scope.Get("func2"); | |
| 309 | 309 | ||
| 310 | 310 | var result1 = func2().As<int>(); | |
| 311 | - Assert.AreEqual(0, result1); | ||
| 311 | + Assert.That(result1, Is.EqualTo(0)); | ||
| 312 | 312 | ||
| 313 | 313 | scope.Set("cc", 20);//it has no effect on the globals of 'func1' | |
| 314 | 314 | var result2 = func2().As<int>(); | |
| 315 | - Assert.AreEqual(-10, result2); | ||
| 315 | + Assert.That(result2, Is.EqualTo(-10)); | ||
| 316 | 316 | scope.Set("cc", 10); //rollback | |
| 317 | 317 | ||
| 318 | 318 | ps.Set("cc", 20); | |
| 319 | 319 | var result3 = func2().As<int>(); | |
| 320 | - Assert.AreEqual(10, result3); | ||
| 320 | + Assert.That(result3, Is.EqualTo(10)); | ||
| 321 | 321 | ps.Set("cc", 10); //rollback | |
| 322 | 322 | } | |
| 323 | 323 | } | |
@@ -437,7 +437,7 @@ public void TestCreate() | |||
| 437 | 437 | scope.Execute(code); | |
| 438 | 438 | ||
| 439 | 439 | Assert.That(scope.TryGet("x", out dynamic x), Is.True); | |
| 440 | - Assert.AreEqual("True", x.ToString()); | ||
| 440 | + Assert.That(x.ToString(), Is.EqualTo("True")); | ||
| 441 | 441 | } | |
| 442 | 442 | ||
| 443 | 443 | [Test] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -146,8 +146,8 @@ public override ValueType Execute(ValueType arg) | |||
| 146 | 146 | "); | |
| 147 | 147 | } | |
| 148 | 148 | var clrObj = obj.As<Domain.MyClass>(); | |
| 149 | - Assert.AreEqual(clrObj.Property, 2); | ||
| 150 | - Assert.AreEqual(clrObj.Field, 20); | ||
| 149 | + Assert.That(2, Is.EqualTo(clrObj.Property)); | ||
| 150 | + Assert.That(20, Is.EqualTo(clrObj.Field)); | ||
| 151 | 151 | } | |
| 152 | 152 | } | |
| 153 | 153 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,7 @@ public static void LoadDefaultArgs() | |||
| 28 | 28 | { | |
| 29 | 29 | using(var argv = new PyList(Runtime.Runtime.PySys_GetObject("argv"))) | |
| 30 | 30 | { | |
| 31 | - Assert.AreNotEqual(0, argv.Length()); | ||
| 31 | + Assert.That(argv.Length(), Is.Not.EqualTo(0)); | ||
| 32 | 32 | } | |
| 33 | 33 | } | |
| 34 | 34 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,7 +22,7 @@ public void SetPythonHome() | |||
| 22 | 22 | PythonEngine.PythonHome = pythonHome; | |
| 23 | 23 | PythonEngine.Initialize(); | |
| 24 | 24 | ||
| 25 | - Assert.AreEqual(pythonHome, PythonEngine.PythonHome); | ||
| 25 | + Assert.That(PythonEngine.PythonHome, Is.EqualTo(pythonHome)); | ||
| 26 | 26 | PythonEngine.Shutdown(); | |
| 27 | 27 | ||
| 28 | 28 | // Restoring valid pythonhome. | |
@@ -45,7 +45,7 @@ public void SetPythonHomeTwice() | |||
| 45 | 45 | PythonEngine.PythonHome = pythonHome; | |
| 46 | 46 | PythonEngine.Initialize(); | |
| 47 | 47 | ||
| 48 | - Assert.AreEqual(pythonHome, PythonEngine.PythonHome); | ||
| 48 | + Assert.That(PythonEngine.PythonHome, Is.EqualTo(pythonHome)); | ||
| 49 | 49 | PythonEngine.Shutdown(); | |
| 50 | 50 | ||
| 51 | 51 | PythonEngine.PythonHome = pythonHomeBackup; | |
@@ -65,7 +65,7 @@ public void SetPythonHomeEmptyString() | |||
| 65 | 65 | } | |
| 66 | 66 | PythonEngine.PythonHome = ""; | |
| 67 | 67 | ||
| 68 | - Assert.AreEqual("", PythonEngine.PythonHome); | ||
| 68 | + Assert.That(PythonEngine.PythonHome, Is.EqualTo("")); | ||
| 69 | 69 | ||
| 70 | 70 | PythonEngine.PythonHome = backup; | |
| 71 | 71 | PythonEngine.Shutdown(); | |
@@ -86,7 +86,7 @@ public void SetProgramName() | |||
| 86 | 86 | PythonEngine.ProgramName = programName; | |
| 87 | 87 | PythonEngine.Initialize(); | |
| 88 | 88 | ||
| 89 | - Assert.AreEqual(programName, PythonEngine.ProgramName); | ||
| 89 | + Assert.That(PythonEngine.ProgramName, Is.EqualTo(programName)); | ||
| 90 | 90 | PythonEngine.Shutdown(); | |
| 91 | 91 | ||
| 92 | 92 | PythonEngine.ProgramName = programNameBackup; | |
@@ -124,7 +124,7 @@ public void SetPythonPath() | |||
| 124 | 124 | PythonEngine.PythonPath = path; | |
| 125 | 125 | PythonEngine.Initialize(); | |
| 126 | 126 | ||
| 127 | - Assert.AreEqual(path, PythonEngine.PythonPath); | ||
| 127 | + Assert.That(PythonEngine.PythonPath, Is.EqualTo(path)); | ||
| 128 | 128 | if (importShouldSucceed) Py.Import(moduleName); | |
| 129 | 129 | ||
| 130 | 130 | PythonEngine.Shutdown(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,11 +16,11 @@ public static void Py_IsInitializedValue() | |||
| 16 | 16 | Runtime.Runtime.PyGILState_Ensure(); | |
| 17 | 17 | } | |
| 18 | 18 | Runtime.Runtime.Py_Finalize(); | |
| 19 | - Assert.AreEqual(0, Runtime.Runtime.Py_IsInitialized()); | ||
| 19 | + Assert.That(Runtime.Runtime.Py_IsInitialized(), Is.EqualTo(0)); | ||
| 20 | 20 | Runtime.Runtime.Py_Initialize(); | |
| 21 | - Assert.AreEqual(1, Runtime.Runtime.Py_IsInitialized()); | ||
| 21 | + Assert.That(Runtime.Runtime.Py_IsInitialized(), Is.EqualTo(1)); | ||
| 22 | 22 | Runtime.Runtime.Py_Finalize(); | |
| 23 | - Assert.AreEqual(0, Runtime.Runtime.Py_IsInitialized()); | ||
| 23 | + Assert.That(Runtime.Runtime.Py_IsInitialized(), Is.EqualTo(0)); | ||
| 24 | 24 | } | |
| 25 | 25 | ||
| 26 | 26 | [Test] | |
@@ -30,27 +30,27 @@ public static void RefCountTest() | |||
| 30 | 30 | using var op = Runtime.Runtime.PyString_FromString("FooBar"); | |
| 31 | 31 | ||
| 32 | 32 | // New object RefCount should be one | |
| 33 | - Assert.AreEqual(1, Runtime.Runtime.Refcount32(op.BorrowOrThrow())); | ||
| 33 | + Assert.That(Runtime.Runtime.Refcount32(op.BorrowOrThrow()), Is.EqualTo(1)); | ||
| 34 | 34 | ||
| 35 | 35 | // Checking refcount didn't change refcount | |
| 36 | - Assert.AreEqual(1, Runtime.Runtime.Refcount32(op.Borrow())); | ||
| 36 | + Assert.That(Runtime.Runtime.Refcount32(op.Borrow()), Is.EqualTo(1)); | ||
| 37 | 37 | ||
| 38 | 38 | // Borrowing a reference doesn't increase refcount | |
| 39 | 39 | BorrowedReference p = op.Borrow(); | |
| 40 | - Assert.AreEqual(1, Runtime.Runtime.Refcount32(p)); | ||
| 40 | + Assert.That(Runtime.Runtime.Refcount32(p), Is.EqualTo(1)); | ||
| 41 | 41 | ||
| 42 | 42 | // Py_IncRef/Py_DecRef increase and decrease RefCount | |
| 43 | 43 | Runtime.Runtime.Py_IncRef(op.Borrow()); | |
| 44 | - Assert.AreEqual(2, Runtime.Runtime.Refcount32(p)); | ||
| 44 | + Assert.That(Runtime.Runtime.Refcount32(p), Is.EqualTo(2)); | ||
| 45 | 45 | Runtime.Runtime.Py_DecRef(StolenReference.DangerousFromPointer(op.DangerousGetAddress())); | |
| 46 | - Assert.AreEqual(1, Runtime.Runtime.Refcount32(p)); | ||
| 46 | + Assert.That(Runtime.Runtime.Refcount32(p), Is.EqualTo(1)); | ||
| 47 | 47 | ||
| 48 | 48 | // XIncref/XDecref increase and decrease RefCount | |
| 49 | 49 | #pragma warning disable CS0618 // Type or member is obsolete. We are testing corresponding members | |
| 50 | 50 | Runtime.Runtime.XIncref(p); | |
| 51 | - Assert.AreEqual(2, Runtime.Runtime.Refcount32(p)); | ||
| 51 | + Assert.That(Runtime.Runtime.Refcount32(p), Is.EqualTo(2)); | ||
| 52 | 52 | Runtime.Runtime.XDecref(op.Steal()); | |
| 53 | - Assert.AreEqual(1, Runtime.Runtime.Refcount32(p)); | ||
| 53 | + Assert.That(Runtime.Runtime.Refcount32(p), Is.EqualTo(1)); | ||
| 54 | 54 | #pragma warning restore CS0618 // Type or member is obsolete | |
| 55 | 55 | ||
| 56 | 56 | op.Dispose(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments