diff --git a/Directory.Build.props b/Directory.Build.props
index 4b0f25d56..377db2ff5 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -4,7 +4,7 @@
Copyright (c) 2006-2025 The Contributors of the Python.NET Project
pythonnet
Python.NET
- 12.0
+ 14
false
true
$([System.IO.File]::ReadAllText("$(MSBuildThisFileDirectory)version.txt").Trim())
diff --git a/src/embed_tests/Codecs.cs b/src/embed_tests/Codecs.cs
index 5879462f5..6159060b3 100644
--- a/src/embed_tests/Codecs.cs
+++ b/src/embed_tests/Codecs.cs
@@ -32,7 +32,7 @@ static void TupleConversionsGeneric()
scope.Set(nameof(tuple), tuple);
scope.Set(nameof(accept), accept);
scope.Exec($"{nameof(accept)}({nameof(tuple)})");
- Assert.AreEqual(expected: tuple, actual: restored);
+ Assert.That(actual: restored, Is.EqualTo(expected: tuple));
}
}
@@ -53,7 +53,7 @@ static void TupleConversionsObject()
scope.Set(nameof(tuple), tuple);
scope.Set(nameof(accept), accept);
scope.Exec($"{nameof(accept)}({nameof(tuple)})");
- Assert.AreEqual(expected: tuple, actual: restored);
+ Assert.That(actual: restored, Is.EqualTo(expected: tuple));
}
}
@@ -67,7 +67,7 @@ static void TupleRoundtripObject()
var tuple = Activator.CreateInstance(typeof(T), 42.0, "42", new object());
using var pyTuple = TupleCodec.Instance.TryEncode(tuple);
Assert.IsTrue(TupleCodec.Instance.TryDecode(pyTuple, out object restored));
- Assert.AreEqual(expected: tuple, actual: restored);
+ Assert.That(actual: restored, Is.EqualTo(expected: tuple));
}
[Test]
@@ -81,7 +81,7 @@ static void TupleRoundtripGeneric()
var tuple = Activator.CreateInstance(typeof(T), 42, "42", new object());
using var pyTuple = TupleCodec.Instance.TryEncode(tuple);
Assert.IsTrue(TupleCodec.Instance.TryDecode(pyTuple, out T restored));
- Assert.AreEqual(expected: tuple, actual: restored);
+ Assert.That(actual: restored, Is.EqualTo(expected: tuple));
}
static PyObject GetPythonIterable() => PythonEngine.Eval("map(lambda x: x, [1,2,3])");
@@ -118,7 +118,7 @@ public void ListDecoderTest()
//the IList will report a Count of 3.
IList stringList = null;
Assert.DoesNotThrow(() => { codec.TryDecode(pyList, out stringList); });
- Assert.AreEqual(stringList.Count, 3);
+ Assert.That(3, Is.EqualTo(stringList.Count));
Assert.Throws(typeof(InvalidCastException), () => { var x = stringList[0]; });
//can't convert python iterable to list (this will require a copy which isn't lossless)
@@ -162,8 +162,8 @@ public void SequenceDecoderTest()
//the IList will report a Count of 3.
ICollection stringCollection = null;
Assert.DoesNotThrow(() => { codec.TryDecode(pyList, out stringCollection); });
- Assert.AreEqual(3, stringCollection.Count());
- Assert.Throws(typeof(InvalidCastException), () => {
+ Assert.That(stringCollection.Count(), Is.EqualTo(3));
+ Assert.Throws(() => {
string[] array = new string[3];
stringCollection.CopyTo(array, 0);
});
@@ -199,8 +199,8 @@ public void SequenceDecoderTest()
//the IList will report a Count of 3.
ICollection stringCollection2 = null;
Assert.DoesNotThrow(() => { codec.TryDecode(pyTuple, out stringCollection2); });
- Assert.AreEqual(3, stringCollection2.Count());
- Assert.Throws(typeof(InvalidCastException), () => {
+ Assert.That(stringCollection2.Count, Is.EqualTo(3));
+ Assert.Throws(() => {
string[] array = new string[3];
stringCollection2.CopyTo(array, 0);
});
@@ -321,7 +321,7 @@ def call(func):
");
var callFunc = scope.Get("call");
string message = callFunc.Invoke(callMeAction.ToPython()).As();
- Assert.AreEqual(TestExceptionMessage, message);
+ Assert.That(message, Is.EqualTo(TestExceptionMessage));
}
[Test]
@@ -331,7 +331,7 @@ public void ExceptionDecoded()
using var scope = Py.CreateScope();
var error = Assert.Throws(()
=> PythonEngine.Exec($"raise ValueError('{TestExceptionMessage}')"));
- Assert.AreEqual(TestExceptionMessage, error.Message);
+ Assert.That(error.Message, Is.EqualTo(TestExceptionMessage));
}
[Test]
@@ -360,7 +360,7 @@ public void FloatDerivedDecoded()
PyObjectConversions.RegisterDecoder(decoder);
using var result = scope.Eval("FloatDerived()");
object decoded = result.As