Add support for async functions #761
Annotations
42 errors and 25 warnings
build (ubuntu-latest, 3.13)
Process completed with exit code 1.
|
build (macos-latest, 3.13)
Process completed with exit code 1.
|
build (windows-latest, 3.13)
Process completed with exit code 1.
|
build (windows-latest, 3.11)
The job running on runner GitHub Actions 10 has exceeded the maximum execution time of 360 minutes.
|
build (windows-latest, 3.11)
The operation was canceled.
|
build (windows-latest, 3.9)
The job running on runner GitHub Actions 2 has exceeded the maximum execution time of 360 minutes.
|
build (windows-latest, 3.9)
The operation was canceled.
|
build (windows-latest, 3.12)
The job running on runner GitHub Actions 4 has exceeded the maximum execution time of 360 minutes.
|
build (windows-latest, 3.12)
The operation was canceled.
|
build (windows-latest, 3.10)
The job running on runner GitHub Actions 12 has exceeded the maximum execution time of 360 minutes.
|
build (windows-latest, 3.10)
The operation was canceled.
|
build (ubuntu-latest, 3.10)
The job running on runner GitHub Actions 16 has exceeded the maximum execution time of 360 minutes.
|
build (ubuntu-latest, 3.10)
The operation was canceled.
|
build (ubuntu-latest, 3.12)
The job running on runner GitHub Actions 7 has exceeded the maximum execution time of 360 minutes.
|
build (ubuntu-latest, 3.12)
The operation was canceled.
|
build (ubuntu-latest, 3.9)
The job running on runner GitHub Actions 15 has exceeded the maximum execution time of 360 minutes.
|
build (ubuntu-latest, 3.9)
The operation was canceled.
|
build (ubuntu-latest, 3.11)
The job running on runner GitHub Actions 17 has exceeded the maximum execution time of 360 minutes.
|
build (ubuntu-latest, 3.11)
The operation was canceled.
|
build (macos-latest, 3.11)
The job running on runner GitHub Actions 11 has exceeded the maximum execution time of 360 minutes.
|
build (macos-latest, 3.11)
The operation was canceled.
|
build (macos-latest, 3.12)
The job running on runner GitHub Actions 18 has exceeded the maximum execution time of 360 minutes.
|
build (macos-latest, 3.12)
The operation was canceled.
|
build (macos-latest, 3.10)
The job running on runner GitHub Actions 8 has exceeded the maximum execution time of 360 minutes.
|
build (macos-latest, 3.10)
The operation was canceled.
|
build (macos-latest, 3.9)
The job running on runner GitHub Actions 3 has exceeded the maximum execution time of 360 minutes.
|
build (macos-latest, 3.9)
The operation was canceled.
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_generators.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-ubuntu-latest-3.13-net8.0.trx
CSnakes.Tests-ubuntu-latest-3.13-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
cp "/home/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.received.txt" "/home/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "657bc350954200f5d7103a2587de60ae"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, bool> ExampleGenerator(long length);
/// <summary>
/// Invokes the Python function <c>test_normal_generator</c>:
/// <code><![CDATA[
/// def test_normal_generator() -> Generator[str, None, None]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator();
}
"
but was
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "628447fb6935f7e3926b93b678146fc8"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
private PyObject __func_test_generator_sequence;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestGeneratorSequence()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_generator_sequence");
PyObject __underlyingPythonFunc = this.__func_test_generator_sequence;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, "
difference
Showing some of the 3577 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 ...
Expected Value | ... 5 7 b c 3 5 0 9 5 4 2 0 0 f 5 d 7 1 0 3 a ...
Actual Value | ... 2 8 4 4 7 f b 6 9 3 5 f 7 e 3 9 2 6 b 9 3 ...
Expected Code | ... 53 55 98 99 51 53 48 57 53 52 50 48 48 102 53 100 55 49 48 51 97 ...
Actual Code | ... 50 56 52 52 55 102 98 54 57 51 53 102 55 101 51 57 50 54 98 57 51 ...
Difference | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ...
Expected Value | ... d 7 1 0 3 a 2 5 8 7 d e 6 0 a e " u 8 ; \n ...
Actual Value | ... 9 2 6 b 9 3 b 6 7 8 1 4 6 f c 8 " u 8 ; \n ...
Expected Code | ... 100 55 49 48 51 97 50 53 56 55 100 101 54 48 97 101 34 117 56 59 10 ...
Actual Code | ... 57 50 54 98 57 51 98 54 55 56 49 52 54 102 99 56 34 117 56 59 10 ...
Difference | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 ...
Expected Value | ... \s \s \s \s \s \s i n t e r n a l \s T e s t C l ...
Actual Value | ... \s \s \s \s \s p r i v a t e \s P y O b j e c t ...
Expected Code | ... 32 32 32 32 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 ...
Actual Code | ... 32 32 32 32 32 112 114 105 118 97 116 101 32 80 121 79 98 106 101 99 116 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 ...
Expected Value | ... t C l a s s I n t e r n a l ( I L o g g e ...
Actual Value | ... e c t \s _ _ f u n c _ t e s t _ g e n e r ...
Expected Code | ... 116 67 108 97 115 115 73 110 116 101 114 110 97 108 40 73 76 111 103 103 101 ...
Actual Code | ... 101 99 116 32 95 95 102 117 110 99 95 116 101 115 116 95 103 101 110 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 ...
Expected Value | ... r < I P y t h o n E n v i r o n m e n t > ...
Actual Value | ... a t o r _ s e q u e n c e ; \n \n \s \s \s \s \s ...
Expected Code | ... 114 60 73 80 121 116 104 111 110 69 110 118 105 114 111 110 109 101 110 116 62 ...
Actual Code | ... 97 116 111 114 95 115 101 113 117 101 110 99 101 59 10 10 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 ...
Expected Value | ... l o g g e r ) \n \s \s \s \s \s \s \s \s { \n \s \s \s ...
Actual Value | ... \s \s i n t e r n a l \s T e s t C l a s s I ...
Expected Code | ... 108 111 103 103 101 114 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 ...
Actual Code | ... 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 97 115 115 73 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 ...
Expected Value | ... \s \s \s \s \s \s \s \s \s t h i s . l o g g e r \s ...
Actual Value | ... n t e r n a l ( I L o g g e r < I P y t h ...
Expected Code | ... 32 32 32 32 32 32 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 ...
Actual Code | ... 110 116 101 114 110 97 108 40 73 76 111 103 103 101 114 60 73 80 121 116 104 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 ...
Expected Value | ... = \s l o g g e r ; \n \s \s \s \s \s \s \s \s \s \s \s ...
Actual Value | ... o n E n v i r o n m e n t > \s l o g g e r ...
Expected Code | ... 61 32 108 111 103 103 101 114 59 10 32 32 32 32 32 32 32 32 32 32 32 ...
Actual Code | ... 111 110 69 110 118 105 114 111 110 109 101 110 116 62 32 108 111 103 103 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 ...
Expected Value | ... \s u s i n g \s ( G I L . A c q u i r e ( ) ...
Actual Value | ... ) \n \s \s \s \s \s \s \s \s { \n \s \s \s \s \s \s \s \s \s ...
Expected Code | ... 32 117 115 105 110 103 32 40 71 73 76 46 65 99 113 117 105 114 101 40 41 ...
Actual Code | ... 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 ...
Expected Value | ... ) \n \s \s \s \s \s \s \s \s \s \s \s \s { \n \s \s \s \s \s ...
Actual Value | ... \s \s \s t h i s . l o g g e r \s = \s l o g g ...
Expected Code | ... 41 10 32 32 32 32 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 ...
Actual Code | ... 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 61 32 108 111 103 103 ...
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_generators.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-macos-latest-3.13-net8.0.trx
CSnakes.Tests-macos-latest-3.13-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
cp "/Users/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.received.txt" "/Users/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "657bc350954200f5d7103a2587de60ae"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, bool> ExampleGenerator(long length);
/// <summary>
/// Invokes the Python function <c>test_normal_generator</c>:
/// <code><![CDATA[
/// def test_normal_generator() -> Generator[str, None, None]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator();
}
"
but was
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "628447fb6935f7e3926b93b678146fc8"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
private PyObject __func_test_generator_sequence;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestGeneratorSequence()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_generator_sequence");
PyObject __underlyingPythonFunc = this.__func_test_generator_sequence;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, "
difference
Showing some of the 3577 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 ...
Expected Value | ... 5 7 b c 3 5 0 9 5 4 2 0 0 f 5 d 7 1 0 3 a ...
Actual Value | ... 2 8 4 4 7 f b 6 9 3 5 f 7 e 3 9 2 6 b 9 3 ...
Expected Code | ... 53 55 98 99 51 53 48 57 53 52 50 48 48 102 53 100 55 49 48 51 97 ...
Actual Code | ... 50 56 52 52 55 102 98 54 57 51 53 102 55 101 51 57 50 54 98 57 51 ...
Difference | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ...
Expected Value | ... d 7 1 0 3 a 2 5 8 7 d e 6 0 a e " u 8 ; \n ...
Actual Value | ... 9 2 6 b 9 3 b 6 7 8 1 4 6 f c 8 " u 8 ; \n ...
Expected Code | ... 100 55 49 48 51 97 50 53 56 55 100 101 54 48 97 101 34 117 56 59 10 ...
Actual Code | ... 57 50 54 98 57 51 98 54 55 56 49 52 54 102 99 56 34 117 56 59 10 ...
Difference | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 ...
Expected Value | ... \s \s \s \s \s \s i n t e r n a l \s T e s t C l ...
Actual Value | ... \s \s \s \s \s p r i v a t e \s P y O b j e c t ...
Expected Code | ... 32 32 32 32 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 ...
Actual Code | ... 32 32 32 32 32 112 114 105 118 97 116 101 32 80 121 79 98 106 101 99 116 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 ...
Expected Value | ... t C l a s s I n t e r n a l ( I L o g g e ...
Actual Value | ... e c t \s _ _ f u n c _ t e s t _ g e n e r ...
Expected Code | ... 116 67 108 97 115 115 73 110 116 101 114 110 97 108 40 73 76 111 103 103 101 ...
Actual Code | ... 101 99 116 32 95 95 102 117 110 99 95 116 101 115 116 95 103 101 110 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 ...
Expected Value | ... r < I P y t h o n E n v i r o n m e n t > ...
Actual Value | ... a t o r _ s e q u e n c e ; \n \n \s \s \s \s \s ...
Expected Code | ... 114 60 73 80 121 116 104 111 110 69 110 118 105 114 111 110 109 101 110 116 62 ...
Actual Code | ... 97 116 111 114 95 115 101 113 117 101 110 99 101 59 10 10 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 ...
Expected Value | ... l o g g e r ) \n \s \s \s \s \s \s \s \s { \n \s \s \s ...
Actual Value | ... \s \s i n t e r n a l \s T e s t C l a s s I ...
Expected Code | ... 108 111 103 103 101 114 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 ...
Actual Code | ... 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 97 115 115 73 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 ...
Expected Value | ... \s \s \s \s \s \s \s \s \s t h i s . l o g g e r \s ...
Actual Value | ... n t e r n a l ( I L o g g e r < I P y t h ...
Expected Code | ... 32 32 32 32 32 32 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 ...
Actual Code | ... 110 116 101 114 110 97 108 40 73 76 111 103 103 101 114 60 73 80 121 116 104 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 ...
Expected Value | ... = \s l o g g e r ; \n \s \s \s \s \s \s \s \s \s \s \s ...
Actual Value | ... o n E n v i r o n m e n t > \s l o g g e r ...
Expected Code | ... 61 32 108 111 103 103 101 114 59 10 32 32 32 32 32 32 32 32 32 32 32 ...
Actual Code | ... 111 110 69 110 118 105 114 111 110 109 101 110 116 62 32 108 111 103 103 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 ...
Expected Value | ... \s u s i n g \s ( G I L . A c q u i r e ( ) ...
Actual Value | ... ) \n \s \s \s \s \s \s \s \s { \n \s \s \s \s \s \s \s \s \s ...
Expected Code | ... 32 117 115 105 110 103 32 40 71 73 76 46 65 99 113 117 105 114 101 40 41 ...
Actual Code | ... 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 ...
Expected Value | ... ) \n \s \s \s \s \s \s \s \s \s \s \s \s { \n \s \s \s \s \s ...
Actual Value | ... \s \s \s t h i s . l o g g e r \s = \s l o g g ...
Expected Code | ... 41 10 32 32 32 32 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 ...
Actual Code | ... 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 61 32 108 111 103 103 ...
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_generators.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-windows-latest-3.13-net8.0.trx
CSnakes.Tests-windows-latest-3.13-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
copy /Y "D:\a\CSnakes\CSnakes\src\CSnakes.Tests\PythonStaticGeneratorTests\FormatClassFromMethods.test_generators.received.txt" "D:\a\CSnakes\CSnakes\src\CSnakes.Tests\PythonStaticGeneratorTests\FormatClassFromMethods.test_generators.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "657bc350954200f5d7103a2587de60ae"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, bool> ExampleGenerator(long length);
/// <summary>
/// Invokes the Python function <c>test_normal_generator</c>:
/// <code><![CDATA[
/// def test_normal_generator() -> Generator[str, None, None]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator();
}
"
but was
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "628447fb6935f7e3926b93b678146fc8"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
private PyObject __func_test_generator_sequence;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestGeneratorSequence()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_generator_sequence");
PyObject __underlyingPythonFunc = this.__func_test_generator_sequence;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, "
difference
Showing some of the 3577 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 ...
Expected Value | ... 5 7 b c 3 5 0 9 5 4 2 0 0 f 5 d 7 1 0 3 a ...
Actual Value | ... 2 8 4 4 7 f b 6 9 3 5 f 7 e 3 9 2 6 b 9 3 ...
Expected Code | ... 53 55 98 99 51 53 48 57 53 52 50 48 48 102 53 100 55 49 48 51 97 ...
Actual Code | ... 50 56 52 52 55 102 98 54 57 51 53 102 55 101 51 57 50 54 98 57 51 ...
Difference | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ...
Expected Value | ... d 7 1 0 3 a 2 5 8 7 d e 6 0 a e " u 8 ; \n ...
Actual Value | ... 9 2 6 b 9 3 b 6 7 8 1 4 6 f c 8 " u 8 ; \n ...
Expected Code | ... 100 55 49 48 51 97 50 53 56 55 100 101 54 48 97 101 34 117 56 59 10 ...
Actual Code | ... 57 50 54 98 57 51 98 54 55 56 49 52 54 102 99 56 34 117 56 59 10 ...
Difference | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 ...
Expected Value | ... \s \s \s \s \s \s i n t e r n a l \s T e s t C l ...
Actual Value | ... \s \s \s \s \s p r i v a t e \s P y O b j e c t ...
Expected Code | ... 32 32 32 32 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 ...
Actual Code | ... 32 32 32 32 32 112 114 105 118 97 116 101 32 80 121 79 98 106 101 99 116 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 ...
Expected Value | ... t C l a s s I n t e r n a l ( I L o g g e ...
Actual Value | ... e c t \s _ _ f u n c _ t e s t _ g e n e r ...
Expected Code | ... 116 67 108 97 115 115 73 110 116 101 114 110 97 108 40 73 76 111 103 103 101 ...
Actual Code | ... 101 99 116 32 95 95 102 117 110 99 95 116 101 115 116 95 103 101 110 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 ...
Expected Value | ... r < I P y t h o n E n v i r o n m e n t > ...
Actual Value | ... a t o r _ s e q u e n c e ; \n \n \s \s \s \s \s ...
Expected Code | ... 114 60 73 80 121 116 104 111 110 69 110 118 105 114 111 110 109 101 110 116 62 ...
Actual Code | ... 97 116 111 114 95 115 101 113 117 101 110 99 101 59 10 10 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 ...
Expected Value | ... l o g g e r ) \n \s \s \s \s \s \s \s \s { \n \s \s \s ...
Actual Value | ... \s \s i n t e r n a l \s T e s t C l a s s I ...
Expected Code | ... 108 111 103 103 101 114 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 ...
Actual Code | ... 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 97 115 115 73 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 ...
Expected Value | ... \s \s \s \s \s \s \s \s \s t h i s . l o g g e r \s ...
Actual Value | ... n t e r n a l ( I L o g g e r < I P y t h ...
Expected Code | ... 32 32 32 32 32 32 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 ...
Actual Code | ... 110 116 101 114 110 97 108 40 73 76 111 103 103 101 114 60 73 80 121 116 104 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 ...
Expected Value | ... = \s l o g g e r ; \n \s \s \s \s \s \s \s \s \s \s \s ...
Actual Value | ... o n E n v i r o n m e n t > \s l o g g e r ...
Expected Code | ... 61 32 108 111 103 103 101 114 59 10 32 32 32 32 32 32 32 32 32 32 32 ...
Actual Code | ... 111 110 69 110 118 105 114 111 110 109 101 110 116 62 32 108 111 103 103 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 ...
Expected Value | ... \s u s i n g \s ( G I L . A c q u i r e ( ) ...
Actual Value | ... ) \n \s \s \s \s \s \s \s \s { \n \s \s \s \s \s \s \s \s \s ...
Expected Code | ... 32 117 115 105 110 103 32 40 71 73 76 46 65 99 113 117 105 114 101 40 41 ...
Actual Code | ... 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 ...
Expected Value | ... ) \n \s \s \s \s \s \s \s \s \s \s \s \s { \n \s \s \s \s \s ...
Actual Value | ... \s \s \s t h i s . l o g g e r \s = \s l o g g ...
Expected Code | ... 41 10 32 32 32 32 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 ...
Actual Code | ... 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 61 32 108 111 103 103 ...
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_generators.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-windows-latest-3.11-net8.0.trx
CSnakes.Tests-windows-latest-3.11-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
copy /Y "D:\a\CSnakes\CSnakes\src\CSnakes.Tests\PythonStaticGeneratorTests\FormatClassFromMethods.test_generators.received.txt" "D:\a\CSnakes\CSnakes\src\CSnakes.Tests\PythonStaticGeneratorTests\FormatClassFromMethods.test_generators.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "657bc350954200f5d7103a2587de60ae"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, bool> ExampleGenerator(long length);
/// <summary>
/// Invokes the Python function <c>test_normal_generator</c>:
/// <code><![CDATA[
/// def test_normal_generator() -> Generator[str, None, None]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator();
}
"
but was
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "628447fb6935f7e3926b93b678146fc8"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
private PyObject __func_test_generator_sequence;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestGeneratorSequence()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_generator_sequence");
PyObject __underlyingPythonFunc = this.__func_test_generator_sequence;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, "
difference
Showing some of the 3577 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 ...
Expected Value | ... 5 7 b c 3 5 0 9 5 4 2 0 0 f 5 d 7 1 0 3 a ...
Actual Value | ... 2 8 4 4 7 f b 6 9 3 5 f 7 e 3 9 2 6 b 9 3 ...
Expected Code | ... 53 55 98 99 51 53 48 57 53 52 50 48 48 102 53 100 55 49 48 51 97 ...
Actual Code | ... 50 56 52 52 55 102 98 54 57 51 53 102 55 101 51 57 50 54 98 57 51 ...
Difference | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ...
Expected Value | ... d 7 1 0 3 a 2 5 8 7 d e 6 0 a e " u 8 ; \n ...
Actual Value | ... 9 2 6 b 9 3 b 6 7 8 1 4 6 f c 8 " u 8 ; \n ...
Expected Code | ... 100 55 49 48 51 97 50 53 56 55 100 101 54 48 97 101 34 117 56 59 10 ...
Actual Code | ... 57 50 54 98 57 51 98 54 55 56 49 52 54 102 99 56 34 117 56 59 10 ...
Difference | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 ...
Expected Value | ... \s \s \s \s \s \s i n t e r n a l \s T e s t C l ...
Actual Value | ... \s \s \s \s \s p r i v a t e \s P y O b j e c t ...
Expected Code | ... 32 32 32 32 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 ...
Actual Code | ... 32 32 32 32 32 112 114 105 118 97 116 101 32 80 121 79 98 106 101 99 116 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 ...
Expected Value | ... t C l a s s I n t e r n a l ( I L o g g e ...
Actual Value | ... e c t \s _ _ f u n c _ t e s t _ g e n e r ...
Expected Code | ... 116 67 108 97 115 115 73 110 116 101 114 110 97 108 40 73 76 111 103 103 101 ...
Actual Code | ... 101 99 116 32 95 95 102 117 110 99 95 116 101 115 116 95 103 101 110 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 ...
Expected Value | ... r < I P y t h o n E n v i r o n m e n t > ...
Actual Value | ... a t o r _ s e q u e n c e ; \n \n \s \s \s \s \s ...
Expected Code | ... 114 60 73 80 121 116 104 111 110 69 110 118 105 114 111 110 109 101 110 116 62 ...
Actual Code | ... 97 116 111 114 95 115 101 113 117 101 110 99 101 59 10 10 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 ...
Expected Value | ... l o g g e r ) \n \s \s \s \s \s \s \s \s { \n \s \s \s ...
Actual Value | ... \s \s i n t e r n a l \s T e s t C l a s s I ...
Expected Code | ... 108 111 103 103 101 114 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 ...
Actual Code | ... 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 97 115 115 73 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 ...
Expected Value | ... \s \s \s \s \s \s \s \s \s t h i s . l o g g e r \s ...
Actual Value | ... n t e r n a l ( I L o g g e r < I P y t h ...
Expected Code | ... 32 32 32 32 32 32 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 ...
Actual Code | ... 110 116 101 114 110 97 108 40 73 76 111 103 103 101 114 60 73 80 121 116 104 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 ...
Expected Value | ... = \s l o g g e r ; \n \s \s \s \s \s \s \s \s \s \s \s ...
Actual Value | ... o n E n v i r o n m e n t > \s l o g g e r ...
Expected Code | ... 61 32 108 111 103 103 101 114 59 10 32 32 32 32 32 32 32 32 32 32 32 ...
Actual Code | ... 111 110 69 110 118 105 114 111 110 109 101 110 116 62 32 108 111 103 103 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 ...
Expected Value | ... \s u s i n g \s ( G I L . A c q u i r e ( ) ...
Actual Value | ... ) \n \s \s \s \s \s \s \s \s { \n \s \s \s \s \s \s \s \s \s ...
Expected Code | ... 32 117 115 105 110 103 32 40 71 73 76 46 65 99 113 117 105 114 101 40 41 ...
Actual Code | ... 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 ...
Expected Value | ... ) \n \s \s \s \s \s \s \s \s \s \s \s \s { \n \s \s \s \s \s ...
Actual Value | ... \s \s \s t h i s . l o g g e r \s = \s l o g g ...
Expected Code | ... 41 10 32 32 32 32 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 ...
Actual Code | ... 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 61 32 108 111 103 103 ...
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_generators.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-windows-latest-3.9-net8.0.trx
CSnakes.Tests-windows-latest-3.9-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
copy /Y "D:\a\CSnakes\CSnakes\src\CSnakes.Tests\PythonStaticGeneratorTests\FormatClassFromMethods.test_generators.received.txt" "D:\a\CSnakes\CSnakes\src\CSnakes.Tests\PythonStaticGeneratorTests\FormatClassFromMethods.test_generators.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "657bc350954200f5d7103a2587de60ae"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, bool> ExampleGenerator(long length);
/// <summary>
/// Invokes the Python function <c>test_normal_generator</c>:
/// <code><![CDATA[
/// def test_normal_generator() -> Generator[str, None, None]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator();
}
"
but was
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "628447fb6935f7e3926b93b678146fc8"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
private PyObject __func_test_generator_sequence;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestGeneratorSequence()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_generator_sequence");
PyObject __underlyingPythonFunc = this.__func_test_generator_sequence;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, "
difference
Showing some of the 3577 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 ...
Expected Value | ... 5 7 b c 3 5 0 9 5 4 2 0 0 f 5 d 7 1 0 3 a ...
Actual Value | ... 2 8 4 4 7 f b 6 9 3 5 f 7 e 3 9 2 6 b 9 3 ...
Expected Code | ... 53 55 98 99 51 53 48 57 53 52 50 48 48 102 53 100 55 49 48 51 97 ...
Actual Code | ... 50 56 52 52 55 102 98 54 57 51 53 102 55 101 51 57 50 54 98 57 51 ...
Difference | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ...
Expected Value | ... d 7 1 0 3 a 2 5 8 7 d e 6 0 a e " u 8 ; \n ...
Actual Value | ... 9 2 6 b 9 3 b 6 7 8 1 4 6 f c 8 " u 8 ; \n ...
Expected Code | ... 100 55 49 48 51 97 50 53 56 55 100 101 54 48 97 101 34 117 56 59 10 ...
Actual Code | ... 57 50 54 98 57 51 98 54 55 56 49 52 54 102 99 56 34 117 56 59 10 ...
Difference | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 ...
Expected Value | ... \s \s \s \s \s \s i n t e r n a l \s T e s t C l ...
Actual Value | ... \s \s \s \s \s p r i v a t e \s P y O b j e c t ...
Expected Code | ... 32 32 32 32 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 ...
Actual Code | ... 32 32 32 32 32 112 114 105 118 97 116 101 32 80 121 79 98 106 101 99 116 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 ...
Expected Value | ... t C l a s s I n t e r n a l ( I L o g g e ...
Actual Value | ... e c t \s _ _ f u n c _ t e s t _ g e n e r ...
Expected Code | ... 116 67 108 97 115 115 73 110 116 101 114 110 97 108 40 73 76 111 103 103 101 ...
Actual Code | ... 101 99 116 32 95 95 102 117 110 99 95 116 101 115 116 95 103 101 110 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 ...
Expected Value | ... r < I P y t h o n E n v i r o n m e n t > ...
Actual Value | ... a t o r _ s e q u e n c e ; \n \n \s \s \s \s \s ...
Expected Code | ... 114 60 73 80 121 116 104 111 110 69 110 118 105 114 111 110 109 101 110 116 62 ...
Actual Code | ... 97 116 111 114 95 115 101 113 117 101 110 99 101 59 10 10 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 ...
Expected Value | ... l o g g e r ) \n \s \s \s \s \s \s \s \s { \n \s \s \s ...
Actual Value | ... \s \s i n t e r n a l \s T e s t C l a s s I ...
Expected Code | ... 108 111 103 103 101 114 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 ...
Actual Code | ... 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 97 115 115 73 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 ...
Expected Value | ... \s \s \s \s \s \s \s \s \s t h i s . l o g g e r \s ...
Actual Value | ... n t e r n a l ( I L o g g e r < I P y t h ...
Expected Code | ... 32 32 32 32 32 32 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 ...
Actual Code | ... 110 116 101 114 110 97 108 40 73 76 111 103 103 101 114 60 73 80 121 116 104 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 ...
Expected Value | ... = \s l o g g e r ; \n \s \s \s \s \s \s \s \s \s \s \s ...
Actual Value | ... o n E n v i r o n m e n t > \s l o g g e r ...
Expected Code | ... 61 32 108 111 103 103 101 114 59 10 32 32 32 32 32 32 32 32 32 32 32 ...
Actual Code | ... 111 110 69 110 118 105 114 111 110 109 101 110 116 62 32 108 111 103 103 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 ...
Expected Value | ... \s u s i n g \s ( G I L . A c q u i r e ( ) ...
Actual Value | ... ) \n \s \s \s \s \s \s \s \s { \n \s \s \s \s \s \s \s \s \s ...
Expected Code | ... 32 117 115 105 110 103 32 40 71 73 76 46 65 99 113 117 105 114 101 40 41 ...
Actual Code | ... 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 ...
Expected Value | ... ) \n \s \s \s \s \s \s \s \s \s \s \s \s { \n \s \s \s \s \s ...
Actual Value | ... \s \s \s t h i s . l o g g e r \s = \s l o g g ...
Expected Code | ... 41 10 32 32 32 32 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 ...
Actual Code | ... 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 61 32 108 111 103 103 ...
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_generators.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-windows-latest-3.10-net8.0.trx
CSnakes.Tests-windows-latest-3.10-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
copy /Y "D:\a\CSnakes\CSnakes\src\CSnakes.Tests\PythonStaticGeneratorTests\FormatClassFromMethods.test_generators.received.txt" "D:\a\CSnakes\CSnakes\src\CSnakes.Tests\PythonStaticGeneratorTests\FormatClassFromMethods.test_generators.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "657bc350954200f5d7103a2587de60ae"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, bool> ExampleGenerator(long length);
/// <summary>
/// Invokes the Python function <c>test_normal_generator</c>:
/// <code><![CDATA[
/// def test_normal_generator() -> Generator[str, None, None]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator();
}
"
but was
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "628447fb6935f7e3926b93b678146fc8"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
private PyObject __func_test_generator_sequence;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestGeneratorSequence()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_generator_sequence");
PyObject __underlyingPythonFunc = this.__func_test_generator_sequence;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, "
difference
Showing some of the 3577 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 ...
Expected Value | ... 5 7 b c 3 5 0 9 5 4 2 0 0 f 5 d 7 1 0 3 a ...
Actual Value | ... 2 8 4 4 7 f b 6 9 3 5 f 7 e 3 9 2 6 b 9 3 ...
Expected Code | ... 53 55 98 99 51 53 48 57 53 52 50 48 48 102 53 100 55 49 48 51 97 ...
Actual Code | ... 50 56 52 52 55 102 98 54 57 51 53 102 55 101 51 57 50 54 98 57 51 ...
Difference | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ...
Expected Value | ... d 7 1 0 3 a 2 5 8 7 d e 6 0 a e " u 8 ; \n ...
Actual Value | ... 9 2 6 b 9 3 b 6 7 8 1 4 6 f c 8 " u 8 ; \n ...
Expected Code | ... 100 55 49 48 51 97 50 53 56 55 100 101 54 48 97 101 34 117 56 59 10 ...
Actual Code | ... 57 50 54 98 57 51 98 54 55 56 49 52 54 102 99 56 34 117 56 59 10 ...
Difference | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 ...
Expected Value | ... \s \s \s \s \s \s i n t e r n a l \s T e s t C l ...
Actual Value | ... \s \s \s \s \s p r i v a t e \s P y O b j e c t ...
Expected Code | ... 32 32 32 32 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 ...
Actual Code | ... 32 32 32 32 32 112 114 105 118 97 116 101 32 80 121 79 98 106 101 99 116 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 ...
Expected Value | ... t C l a s s I n t e r n a l ( I L o g g e ...
Actual Value | ... e c t \s _ _ f u n c _ t e s t _ g e n e r ...
Expected Code | ... 116 67 108 97 115 115 73 110 116 101 114 110 97 108 40 73 76 111 103 103 101 ...
Actual Code | ... 101 99 116 32 95 95 102 117 110 99 95 116 101 115 116 95 103 101 110 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 ...
Expected Value | ... r < I P y t h o n E n v i r o n m e n t > ...
Actual Value | ... a t o r _ s e q u e n c e ; \n \n \s \s \s \s \s ...
Expected Code | ... 114 60 73 80 121 116 104 111 110 69 110 118 105 114 111 110 109 101 110 116 62 ...
Actual Code | ... 97 116 111 114 95 115 101 113 117 101 110 99 101 59 10 10 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 ...
Expected Value | ... l o g g e r ) \n \s \s \s \s \s \s \s \s { \n \s \s \s ...
Actual Value | ... \s \s i n t e r n a l \s T e s t C l a s s I ...
Expected Code | ... 108 111 103 103 101 114 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 ...
Actual Code | ... 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 97 115 115 73 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 ...
Expected Value | ... \s \s \s \s \s \s \s \s \s t h i s . l o g g e r \s ...
Actual Value | ... n t e r n a l ( I L o g g e r < I P y t h ...
Expected Code | ... 32 32 32 32 32 32 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 ...
Actual Code | ... 110 116 101 114 110 97 108 40 73 76 111 103 103 101 114 60 73 80 121 116 104 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 ...
Expected Value | ... = \s l o g g e r ; \n \s \s \s \s \s \s \s \s \s \s \s ...
Actual Value | ... o n E n v i r o n m e n t > \s l o g g e r ...
Expected Code | ... 61 32 108 111 103 103 101 114 59 10 32 32 32 32 32 32 32 32 32 32 32 ...
Actual Code | ... 111 110 69 110 118 105 114 111 110 109 101 110 116 62 32 108 111 103 103 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 ...
Expected Value | ... \s u s i n g \s ( G I L . A c q u i r e ( ) ...
Actual Value | ... ) \n \s \s \s \s \s \s \s \s { \n \s \s \s \s \s \s \s \s \s ...
Expected Code | ... 32 117 115 105 110 103 32 40 71 73 76 46 65 99 113 117 105 114 101 40 41 ...
Actual Code | ... 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 ...
Expected Value | ... ) \n \s \s \s \s \s \s \s \s \s \s \s \s { \n \s \s \s \s \s ...
Actual Value | ... \s \s \s t h i s . l o g g e r \s = \s l o g g ...
Expected Code | ... 41 10 32 32 32 32 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 ...
Actual Code | ... 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 61 32 108 111 103 103 ...
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_generators.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-windows-latest-3.12-net8.0.trx
CSnakes.Tests-windows-latest-3.12-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
copy /Y "D:\a\CSnakes\CSnakes\src\CSnakes.Tests\PythonStaticGeneratorTests\FormatClassFromMethods.test_generators.received.txt" "D:\a\CSnakes\CSnakes\src\CSnakes.Tests\PythonStaticGeneratorTests\FormatClassFromMethods.test_generators.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "657bc350954200f5d7103a2587de60ae"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, bool> ExampleGenerator(long length);
/// <summary>
/// Invokes the Python function <c>test_normal_generator</c>:
/// <code><![CDATA[
/// def test_normal_generator() -> Generator[str, None, None]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator();
}
"
but was
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "628447fb6935f7e3926b93b678146fc8"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
private PyObject __func_test_generator_sequence;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestGeneratorSequence()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_generator_sequence");
PyObject __underlyingPythonFunc = this.__func_test_generator_sequence;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, "
difference
Showing some of the 3577 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 ...
Expected Value | ... 5 7 b c 3 5 0 9 5 4 2 0 0 f 5 d 7 1 0 3 a ...
Actual Value | ... 2 8 4 4 7 f b 6 9 3 5 f 7 e 3 9 2 6 b 9 3 ...
Expected Code | ... 53 55 98 99 51 53 48 57 53 52 50 48 48 102 53 100 55 49 48 51 97 ...
Actual Code | ... 50 56 52 52 55 102 98 54 57 51 53 102 55 101 51 57 50 54 98 57 51 ...
Difference | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ...
Expected Value | ... d 7 1 0 3 a 2 5 8 7 d e 6 0 a e " u 8 ; \n ...
Actual Value | ... 9 2 6 b 9 3 b 6 7 8 1 4 6 f c 8 " u 8 ; \n ...
Expected Code | ... 100 55 49 48 51 97 50 53 56 55 100 101 54 48 97 101 34 117 56 59 10 ...
Actual Code | ... 57 50 54 98 57 51 98 54 55 56 49 52 54 102 99 56 34 117 56 59 10 ...
Difference | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 ...
Expected Value | ... \s \s \s \s \s \s i n t e r n a l \s T e s t C l ...
Actual Value | ... \s \s \s \s \s p r i v a t e \s P y O b j e c t ...
Expected Code | ... 32 32 32 32 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 ...
Actual Code | ... 32 32 32 32 32 112 114 105 118 97 116 101 32 80 121 79 98 106 101 99 116 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 ...
Expected Value | ... t C l a s s I n t e r n a l ( I L o g g e ...
Actual Value | ... e c t \s _ _ f u n c _ t e s t _ g e n e r ...
Expected Code | ... 116 67 108 97 115 115 73 110 116 101 114 110 97 108 40 73 76 111 103 103 101 ...
Actual Code | ... 101 99 116 32 95 95 102 117 110 99 95 116 101 115 116 95 103 101 110 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 ...
Expected Value | ... r < I P y t h o n E n v i r o n m e n t > ...
Actual Value | ... a t o r _ s e q u e n c e ; \n \n \s \s \s \s \s ...
Expected Code | ... 114 60 73 80 121 116 104 111 110 69 110 118 105 114 111 110 109 101 110 116 62 ...
Actual Code | ... 97 116 111 114 95 115 101 113 117 101 110 99 101 59 10 10 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 ...
Expected Value | ... l o g g e r ) \n \s \s \s \s \s \s \s \s { \n \s \s \s ...
Actual Value | ... \s \s i n t e r n a l \s T e s t C l a s s I ...
Expected Code | ... 108 111 103 103 101 114 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 ...
Actual Code | ... 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 97 115 115 73 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 ...
Expected Value | ... \s \s \s \s \s \s \s \s \s t h i s . l o g g e r \s ...
Actual Value | ... n t e r n a l ( I L o g g e r < I P y t h ...
Expected Code | ... 32 32 32 32 32 32 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 ...
Actual Code | ... 110 116 101 114 110 97 108 40 73 76 111 103 103 101 114 60 73 80 121 116 104 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 ...
Expected Value | ... = \s l o g g e r ; \n \s \s \s \s \s \s \s \s \s \s \s ...
Actual Value | ... o n E n v i r o n m e n t > \s l o g g e r ...
Expected Code | ... 61 32 108 111 103 103 101 114 59 10 32 32 32 32 32 32 32 32 32 32 32 ...
Actual Code | ... 111 110 69 110 118 105 114 111 110 109 101 110 116 62 32 108 111 103 103 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 ...
Expected Value | ... \s u s i n g \s ( G I L . A c q u i r e ( ) ...
Actual Value | ... ) \n \s \s \s \s \s \s \s \s { \n \s \s \s \s \s \s \s \s \s ...
Expected Code | ... 32 117 115 105 110 103 32 40 71 73 76 46 65 99 113 117 105 114 101 40 41 ...
Actual Code | ... 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 ...
Expected Value | ... ) \n \s \s \s \s \s \s \s \s \s \s \s \s { \n \s \s \s \s \s ...
Actual Value | ... \s \s \s t h i s . l o g g e r \s = \s l o g g ...
Expected Code | ... 41 10 32 32 32 32 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 ...
Actual Code | ... 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 61 32 108 111 103 103 ...
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_generators.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-ubuntu-latest-3.10-net8.0.trx
CSnakes.Tests-ubuntu-latest-3.10-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
cp "/home/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.received.txt" "/home/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "657bc350954200f5d7103a2587de60ae"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, bool> ExampleGenerator(long length);
/// <summary>
/// Invokes the Python function <c>test_normal_generator</c>:
/// <code><![CDATA[
/// def test_normal_generator() -> Generator[str, None, None]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator();
}
"
but was
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "628447fb6935f7e3926b93b678146fc8"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
private PyObject __func_test_generator_sequence;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestGeneratorSequence()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_generator_sequence");
PyObject __underlyingPythonFunc = this.__func_test_generator_sequence;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, "
difference
Showing some of the 3577 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 ...
Expected Value | ... 5 7 b c 3 5 0 9 5 4 2 0 0 f 5 d 7 1 0 3 a ...
Actual Value | ... 2 8 4 4 7 f b 6 9 3 5 f 7 e 3 9 2 6 b 9 3 ...
Expected Code | ... 53 55 98 99 51 53 48 57 53 52 50 48 48 102 53 100 55 49 48 51 97 ...
Actual Code | ... 50 56 52 52 55 102 98 54 57 51 53 102 55 101 51 57 50 54 98 57 51 ...
Difference | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ...
Expected Value | ... d 7 1 0 3 a 2 5 8 7 d e 6 0 a e " u 8 ; \n ...
Actual Value | ... 9 2 6 b 9 3 b 6 7 8 1 4 6 f c 8 " u 8 ; \n ...
Expected Code | ... 100 55 49 48 51 97 50 53 56 55 100 101 54 48 97 101 34 117 56 59 10 ...
Actual Code | ... 57 50 54 98 57 51 98 54 55 56 49 52 54 102 99 56 34 117 56 59 10 ...
Difference | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 ...
Expected Value | ... \s \s \s \s \s \s i n t e r n a l \s T e s t C l ...
Actual Value | ... \s \s \s \s \s p r i v a t e \s P y O b j e c t ...
Expected Code | ... 32 32 32 32 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 ...
Actual Code | ... 32 32 32 32 32 112 114 105 118 97 116 101 32 80 121 79 98 106 101 99 116 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 ...
Expected Value | ... t C l a s s I n t e r n a l ( I L o g g e ...
Actual Value | ... e c t \s _ _ f u n c _ t e s t _ g e n e r ...
Expected Code | ... 116 67 108 97 115 115 73 110 116 101 114 110 97 108 40 73 76 111 103 103 101 ...
Actual Code | ... 101 99 116 32 95 95 102 117 110 99 95 116 101 115 116 95 103 101 110 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 ...
Expected Value | ... r < I P y t h o n E n v i r o n m e n t > ...
Actual Value | ... a t o r _ s e q u e n c e ; \n \n \s \s \s \s \s ...
Expected Code | ... 114 60 73 80 121 116 104 111 110 69 110 118 105 114 111 110 109 101 110 116 62 ...
Actual Code | ... 97 116 111 114 95 115 101 113 117 101 110 99 101 59 10 10 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 ...
Expected Value | ... l o g g e r ) \n \s \s \s \s \s \s \s \s { \n \s \s \s ...
Actual Value | ... \s \s i n t e r n a l \s T e s t C l a s s I ...
Expected Code | ... 108 111 103 103 101 114 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 ...
Actual Code | ... 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 97 115 115 73 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 ...
Expected Value | ... \s \s \s \s \s \s \s \s \s t h i s . l o g g e r \s ...
Actual Value | ... n t e r n a l ( I L o g g e r < I P y t h ...
Expected Code | ... 32 32 32 32 32 32 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 ...
Actual Code | ... 110 116 101 114 110 97 108 40 73 76 111 103 103 101 114 60 73 80 121 116 104 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 ...
Expected Value | ... = \s l o g g e r ; \n \s \s \s \s \s \s \s \s \s \s \s ...
Actual Value | ... o n E n v i r o n m e n t > \s l o g g e r ...
Expected Code | ... 61 32 108 111 103 103 101 114 59 10 32 32 32 32 32 32 32 32 32 32 32 ...
Actual Code | ... 111 110 69 110 118 105 114 111 110 109 101 110 116 62 32 108 111 103 103 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 ...
Expected Value | ... \s u s i n g \s ( G I L . A c q u i r e ( ) ...
Actual Value | ... ) \n \s \s \s \s \s \s \s \s { \n \s \s \s \s \s \s \s \s \s ...
Expected Code | ... 32 117 115 105 110 103 32 40 71 73 76 46 65 99 113 117 105 114 101 40 41 ...
Actual Code | ... 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 ...
Expected Value | ... ) \n \s \s \s \s \s \s \s \s \s \s \s \s { \n \s \s \s \s \s ...
Actual Value | ... \s \s \s t h i s . l o g g e r \s = \s l o g g ...
Expected Code | ... 41 10 32 32 32 32 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 ...
Actual Code | ... 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 61 32 108 111 103 103 ...
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_generators.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-ubuntu-latest-3.12-net8.0.trx
CSnakes.Tests-ubuntu-latest-3.12-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
cp "/home/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.received.txt" "/home/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "657bc350954200f5d7103a2587de60ae"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, bool> ExampleGenerator(long length);
/// <summary>
/// Invokes the Python function <c>test_normal_generator</c>:
/// <code><![CDATA[
/// def test_normal_generator() -> Generator[str, None, None]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator();
}
"
but was
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "628447fb6935f7e3926b93b678146fc8"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
private PyObject __func_test_generator_sequence;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestGeneratorSequence()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_generator_sequence");
PyObject __underlyingPythonFunc = this.__func_test_generator_sequence;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, "
difference
Showing some of the 3577 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 ...
Expected Value | ... 5 7 b c 3 5 0 9 5 4 2 0 0 f 5 d 7 1 0 3 a ...
Actual Value | ... 2 8 4 4 7 f b 6 9 3 5 f 7 e 3 9 2 6 b 9 3 ...
Expected Code | ... 53 55 98 99 51 53 48 57 53 52 50 48 48 102 53 100 55 49 48 51 97 ...
Actual Code | ... 50 56 52 52 55 102 98 54 57 51 53 102 55 101 51 57 50 54 98 57 51 ...
Difference | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ...
Expected Value | ... d 7 1 0 3 a 2 5 8 7 d e 6 0 a e " u 8 ; \n ...
Actual Value | ... 9 2 6 b 9 3 b 6 7 8 1 4 6 f c 8 " u 8 ; \n ...
Expected Code | ... 100 55 49 48 51 97 50 53 56 55 100 101 54 48 97 101 34 117 56 59 10 ...
Actual Code | ... 57 50 54 98 57 51 98 54 55 56 49 52 54 102 99 56 34 117 56 59 10 ...
Difference | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 ...
Expected Value | ... \s \s \s \s \s \s i n t e r n a l \s T e s t C l ...
Actual Value | ... \s \s \s \s \s p r i v a t e \s P y O b j e c t ...
Expected Code | ... 32 32 32 32 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 ...
Actual Code | ... 32 32 32 32 32 112 114 105 118 97 116 101 32 80 121 79 98 106 101 99 116 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 ...
Expected Value | ... t C l a s s I n t e r n a l ( I L o g g e ...
Actual Value | ... e c t \s _ _ f u n c _ t e s t _ g e n e r ...
Expected Code | ... 116 67 108 97 115 115 73 110 116 101 114 110 97 108 40 73 76 111 103 103 101 ...
Actual Code | ... 101 99 116 32 95 95 102 117 110 99 95 116 101 115 116 95 103 101 110 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 ...
Expected Value | ... r < I P y t h o n E n v i r o n m e n t > ...
Actual Value | ... a t o r _ s e q u e n c e ; \n \n \s \s \s \s \s ...
Expected Code | ... 114 60 73 80 121 116 104 111 110 69 110 118 105 114 111 110 109 101 110 116 62 ...
Actual Code | ... 97 116 111 114 95 115 101 113 117 101 110 99 101 59 10 10 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 ...
Expected Value | ... l o g g e r ) \n \s \s \s \s \s \s \s \s { \n \s \s \s ...
Actual Value | ... \s \s i n t e r n a l \s T e s t C l a s s I ...
Expected Code | ... 108 111 103 103 101 114 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 ...
Actual Code | ... 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 97 115 115 73 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 ...
Expected Value | ... \s \s \s \s \s \s \s \s \s t h i s . l o g g e r \s ...
Actual Value | ... n t e r n a l ( I L o g g e r < I P y t h ...
Expected Code | ... 32 32 32 32 32 32 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 ...
Actual Code | ... 110 116 101 114 110 97 108 40 73 76 111 103 103 101 114 60 73 80 121 116 104 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 ...
Expected Value | ... = \s l o g g e r ; \n \s \s \s \s \s \s \s \s \s \s \s ...
Actual Value | ... o n E n v i r o n m e n t > \s l o g g e r ...
Expected Code | ... 61 32 108 111 103 103 101 114 59 10 32 32 32 32 32 32 32 32 32 32 32 ...
Actual Code | ... 111 110 69 110 118 105 114 111 110 109 101 110 116 62 32 108 111 103 103 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 ...
Expected Value | ... \s u s i n g \s ( G I L . A c q u i r e ( ) ...
Actual Value | ... ) \n \s \s \s \s \s \s \s \s { \n \s \s \s \s \s \s \s \s \s ...
Expected Code | ... 32 117 115 105 110 103 32 40 71 73 76 46 65 99 113 117 105 114 101 40 41 ...
Actual Code | ... 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 ...
Expected Value | ... ) \n \s \s \s \s \s \s \s \s \s \s \s \s { \n \s \s \s \s \s ...
Actual Value | ... \s \s \s t h i s . l o g g e r \s = \s l o g g ...
Expected Code | ... 41 10 32 32 32 32 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 ...
Actual Code | ... 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 61 32 108 111 103 103 ...
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_generators.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-ubuntu-latest-3.11-net8.0.trx
CSnakes.Tests-ubuntu-latest-3.11-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
cp "/home/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.received.txt" "/home/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "657bc350954200f5d7103a2587de60ae"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, bool> ExampleGenerator(long length);
/// <summary>
/// Invokes the Python function <c>test_normal_generator</c>:
/// <code><![CDATA[
/// def test_normal_generator() -> Generator[str, None, None]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator();
}
"
but was
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "628447fb6935f7e3926b93b678146fc8"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
private PyObject __func_test_generator_sequence;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestGeneratorSequence()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_generator_sequence");
PyObject __underlyingPythonFunc = this.__func_test_generator_sequence;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, "
difference
Showing some of the 3577 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 ...
Expected Value | ... 5 7 b c 3 5 0 9 5 4 2 0 0 f 5 d 7 1 0 3 a ...
Actual Value | ... 2 8 4 4 7 f b 6 9 3 5 f 7 e 3 9 2 6 b 9 3 ...
Expected Code | ... 53 55 98 99 51 53 48 57 53 52 50 48 48 102 53 100 55 49 48 51 97 ...
Actual Code | ... 50 56 52 52 55 102 98 54 57 51 53 102 55 101 51 57 50 54 98 57 51 ...
Difference | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ...
Expected Value | ... d 7 1 0 3 a 2 5 8 7 d e 6 0 a e " u 8 ; \n ...
Actual Value | ... 9 2 6 b 9 3 b 6 7 8 1 4 6 f c 8 " u 8 ; \n ...
Expected Code | ... 100 55 49 48 51 97 50 53 56 55 100 101 54 48 97 101 34 117 56 59 10 ...
Actual Code | ... 57 50 54 98 57 51 98 54 55 56 49 52 54 102 99 56 34 117 56 59 10 ...
Difference | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 ...
Expected Value | ... \s \s \s \s \s \s i n t e r n a l \s T e s t C l ...
Actual Value | ... \s \s \s \s \s p r i v a t e \s P y O b j e c t ...
Expected Code | ... 32 32 32 32 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 ...
Actual Code | ... 32 32 32 32 32 112 114 105 118 97 116 101 32 80 121 79 98 106 101 99 116 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 ...
Expected Value | ... t C l a s s I n t e r n a l ( I L o g g e ...
Actual Value | ... e c t \s _ _ f u n c _ t e s t _ g e n e r ...
Expected Code | ... 116 67 108 97 115 115 73 110 116 101 114 110 97 108 40 73 76 111 103 103 101 ...
Actual Code | ... 101 99 116 32 95 95 102 117 110 99 95 116 101 115 116 95 103 101 110 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 ...
Expected Value | ... r < I P y t h o n E n v i r o n m e n t > ...
Actual Value | ... a t o r _ s e q u e n c e ; \n \n \s \s \s \s \s ...
Expected Code | ... 114 60 73 80 121 116 104 111 110 69 110 118 105 114 111 110 109 101 110 116 62 ...
Actual Code | ... 97 116 111 114 95 115 101 113 117 101 110 99 101 59 10 10 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 ...
Expected Value | ... l o g g e r ) \n \s \s \s \s \s \s \s \s { \n \s \s \s ...
Actual Value | ... \s \s i n t e r n a l \s T e s t C l a s s I ...
Expected Code | ... 108 111 103 103 101 114 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 ...
Actual Code | ... 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 97 115 115 73 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 ...
Expected Value | ... \s \s \s \s \s \s \s \s \s t h i s . l o g g e r \s ...
Actual Value | ... n t e r n a l ( I L o g g e r < I P y t h ...
Expected Code | ... 32 32 32 32 32 32 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 ...
Actual Code | ... 110 116 101 114 110 97 108 40 73 76 111 103 103 101 114 60 73 80 121 116 104 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 ...
Expected Value | ... = \s l o g g e r ; \n \s \s \s \s \s \s \s \s \s \s \s ...
Actual Value | ... o n E n v i r o n m e n t > \s l o g g e r ...
Expected Code | ... 61 32 108 111 103 103 101 114 59 10 32 32 32 32 32 32 32 32 32 32 32 ...
Actual Code | ... 111 110 69 110 118 105 114 111 110 109 101 110 116 62 32 108 111 103 103 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 ...
Expected Value | ... \s u s i n g \s ( G I L . A c q u i r e ( ) ...
Actual Value | ... ) \n \s \s \s \s \s \s \s \s { \n \s \s \s \s \s \s \s \s \s ...
Expected Code | ... 32 117 115 105 110 103 32 40 71 73 76 46 65 99 113 117 105 114 101 40 41 ...
Actual Code | ... 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 ...
Expected Value | ... ) \n \s \s \s \s \s \s \s \s \s \s \s \s { \n \s \s \s \s \s ...
Actual Value | ... \s \s \s t h i s . l o g g e r \s = \s l o g g ...
Expected Code | ... 41 10 32 32 32 32 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 ...
Actual Code | ... 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 61 32 108 111 103 103 ...
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_generators.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-ubuntu-latest-3.9-net8.0.trx
CSnakes.Tests-ubuntu-latest-3.9-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
cp "/home/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.received.txt" "/home/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "657bc350954200f5d7103a2587de60ae"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, bool> ExampleGenerator(long length);
/// <summary>
/// Invokes the Python function <c>test_normal_generator</c>:
/// <code><![CDATA[
/// def test_normal_generator() -> Generator[str, None, None]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator();
}
"
but was
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "628447fb6935f7e3926b93b678146fc8"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
private PyObject __func_test_generator_sequence;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestGeneratorSequence()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_generator_sequence");
PyObject __underlyingPythonFunc = this.__func_test_generator_sequence;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, "
difference
Showing some of the 3577 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 ...
Expected Value | ... 5 7 b c 3 5 0 9 5 4 2 0 0 f 5 d 7 1 0 3 a ...
Actual Value | ... 2 8 4 4 7 f b 6 9 3 5 f 7 e 3 9 2 6 b 9 3 ...
Expected Code | ... 53 55 98 99 51 53 48 57 53 52 50 48 48 102 53 100 55 49 48 51 97 ...
Actual Code | ... 50 56 52 52 55 102 98 54 57 51 53 102 55 101 51 57 50 54 98 57 51 ...
Difference | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ...
Expected Value | ... d 7 1 0 3 a 2 5 8 7 d e 6 0 a e " u 8 ; \n ...
Actual Value | ... 9 2 6 b 9 3 b 6 7 8 1 4 6 f c 8 " u 8 ; \n ...
Expected Code | ... 100 55 49 48 51 97 50 53 56 55 100 101 54 48 97 101 34 117 56 59 10 ...
Actual Code | ... 57 50 54 98 57 51 98 54 55 56 49 52 54 102 99 56 34 117 56 59 10 ...
Difference | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 ...
Expected Value | ... \s \s \s \s \s \s i n t e r n a l \s T e s t C l ...
Actual Value | ... \s \s \s \s \s p r i v a t e \s P y O b j e c t ...
Expected Code | ... 32 32 32 32 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 ...
Actual Code | ... 32 32 32 32 32 112 114 105 118 97 116 101 32 80 121 79 98 106 101 99 116 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 ...
Expected Value | ... t C l a s s I n t e r n a l ( I L o g g e ...
Actual Value | ... e c t \s _ _ f u n c _ t e s t _ g e n e r ...
Expected Code | ... 116 67 108 97 115 115 73 110 116 101 114 110 97 108 40 73 76 111 103 103 101 ...
Actual Code | ... 101 99 116 32 95 95 102 117 110 99 95 116 101 115 116 95 103 101 110 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 ...
Expected Value | ... r < I P y t h o n E n v i r o n m e n t > ...
Actual Value | ... a t o r _ s e q u e n c e ; \n \n \s \s \s \s \s ...
Expected Code | ... 114 60 73 80 121 116 104 111 110 69 110 118 105 114 111 110 109 101 110 116 62 ...
Actual Code | ... 97 116 111 114 95 115 101 113 117 101 110 99 101 59 10 10 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 ...
Expected Value | ... l o g g e r ) \n \s \s \s \s \s \s \s \s { \n \s \s \s ...
Actual Value | ... \s \s i n t e r n a l \s T e s t C l a s s I ...
Expected Code | ... 108 111 103 103 101 114 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 ...
Actual Code | ... 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 97 115 115 73 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 ...
Expected Value | ... \s \s \s \s \s \s \s \s \s t h i s . l o g g e r \s ...
Actual Value | ... n t e r n a l ( I L o g g e r < I P y t h ...
Expected Code | ... 32 32 32 32 32 32 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 ...
Actual Code | ... 110 116 101 114 110 97 108 40 73 76 111 103 103 101 114 60 73 80 121 116 104 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 ...
Expected Value | ... = \s l o g g e r ; \n \s \s \s \s \s \s \s \s \s \s \s ...
Actual Value | ... o n E n v i r o n m e n t > \s l o g g e r ...
Expected Code | ... 61 32 108 111 103 103 101 114 59 10 32 32 32 32 32 32 32 32 32 32 32 ...
Actual Code | ... 111 110 69 110 118 105 114 111 110 109 101 110 116 62 32 108 111 103 103 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 ...
Expected Value | ... \s u s i n g \s ( G I L . A c q u i r e ( ) ...
Actual Value | ... ) \n \s \s \s \s \s \s \s \s { \n \s \s \s \s \s \s \s \s \s ...
Expected Code | ... 32 117 115 105 110 103 32 40 71 73 76 46 65 99 113 117 105 114 101 40 41 ...
Actual Code | ... 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 ...
Expected Value | ... ) \n \s \s \s \s \s \s \s \s \s \s \s \s { \n \s \s \s \s \s ...
Actual Value | ... \s \s \s t h i s . l o g g e r \s = \s l o g g ...
Expected Code | ... 41 10 32 32 32 32 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 ...
Actual Code | ... 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 61 32 108 111 103 103 ...
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_generators.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-macos-latest-3.11-net8.0.trx
CSnakes.Tests-macos-latest-3.11-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
cp "/Users/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.received.txt" "/Users/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "657bc350954200f5d7103a2587de60ae"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, bool> ExampleGenerator(long length);
/// <summary>
/// Invokes the Python function <c>test_normal_generator</c>:
/// <code><![CDATA[
/// def test_normal_generator() -> Generator[str, None, None]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator();
}
"
but was
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "628447fb6935f7e3926b93b678146fc8"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
private PyObject __func_test_generator_sequence;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestGeneratorSequence()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_generator_sequence");
PyObject __underlyingPythonFunc = this.__func_test_generator_sequence;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, "
difference
Showing some of the 3577 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 ...
Expected Value | ... 5 7 b c 3 5 0 9 5 4 2 0 0 f 5 d 7 1 0 3 a ...
Actual Value | ... 2 8 4 4 7 f b 6 9 3 5 f 7 e 3 9 2 6 b 9 3 ...
Expected Code | ... 53 55 98 99 51 53 48 57 53 52 50 48 48 102 53 100 55 49 48 51 97 ...
Actual Code | ... 50 56 52 52 55 102 98 54 57 51 53 102 55 101 51 57 50 54 98 57 51 ...
Difference | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ...
Expected Value | ... d 7 1 0 3 a 2 5 8 7 d e 6 0 a e " u 8 ; \n ...
Actual Value | ... 9 2 6 b 9 3 b 6 7 8 1 4 6 f c 8 " u 8 ; \n ...
Expected Code | ... 100 55 49 48 51 97 50 53 56 55 100 101 54 48 97 101 34 117 56 59 10 ...
Actual Code | ... 57 50 54 98 57 51 98 54 55 56 49 52 54 102 99 56 34 117 56 59 10 ...
Difference | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 ...
Expected Value | ... \s \s \s \s \s \s i n t e r n a l \s T e s t C l ...
Actual Value | ... \s \s \s \s \s p r i v a t e \s P y O b j e c t ...
Expected Code | ... 32 32 32 32 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 ...
Actual Code | ... 32 32 32 32 32 112 114 105 118 97 116 101 32 80 121 79 98 106 101 99 116 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 ...
Expected Value | ... t C l a s s I n t e r n a l ( I L o g g e ...
Actual Value | ... e c t \s _ _ f u n c _ t e s t _ g e n e r ...
Expected Code | ... 116 67 108 97 115 115 73 110 116 101 114 110 97 108 40 73 76 111 103 103 101 ...
Actual Code | ... 101 99 116 32 95 95 102 117 110 99 95 116 101 115 116 95 103 101 110 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 ...
Expected Value | ... r < I P y t h o n E n v i r o n m e n t > ...
Actual Value | ... a t o r _ s e q u e n c e ; \n \n \s \s \s \s \s ...
Expected Code | ... 114 60 73 80 121 116 104 111 110 69 110 118 105 114 111 110 109 101 110 116 62 ...
Actual Code | ... 97 116 111 114 95 115 101 113 117 101 110 99 101 59 10 10 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 ...
Expected Value | ... l o g g e r ) \n \s \s \s \s \s \s \s \s { \n \s \s \s ...
Actual Value | ... \s \s i n t e r n a l \s T e s t C l a s s I ...
Expected Code | ... 108 111 103 103 101 114 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 ...
Actual Code | ... 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 97 115 115 73 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 ...
Expected Value | ... \s \s \s \s \s \s \s \s \s t h i s . l o g g e r \s ...
Actual Value | ... n t e r n a l ( I L o g g e r < I P y t h ...
Expected Code | ... 32 32 32 32 32 32 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 ...
Actual Code | ... 110 116 101 114 110 97 108 40 73 76 111 103 103 101 114 60 73 80 121 116 104 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 ...
Expected Value | ... = \s l o g g e r ; \n \s \s \s \s \s \s \s \s \s \s \s ...
Actual Value | ... o n E n v i r o n m e n t > \s l o g g e r ...
Expected Code | ... 61 32 108 111 103 103 101 114 59 10 32 32 32 32 32 32 32 32 32 32 32 ...
Actual Code | ... 111 110 69 110 118 105 114 111 110 109 101 110 116 62 32 108 111 103 103 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 ...
Expected Value | ... \s u s i n g \s ( G I L . A c q u i r e ( ) ...
Actual Value | ... ) \n \s \s \s \s \s \s \s \s { \n \s \s \s \s \s \s \s \s \s ...
Expected Code | ... 32 117 115 105 110 103 32 40 71 73 76 46 65 99 113 117 105 114 101 40 41 ...
Actual Code | ... 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 ...
Expected Value | ... ) \n \s \s \s \s \s \s \s \s \s \s \s \s { \n \s \s \s \s \s ...
Actual Value | ... \s \s \s t h i s . l o g g e r \s = \s l o g g ...
Expected Code | ... 41 10 32 32 32 32 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 ...
Actual Code | ... 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 61 32 108 111 103 103 ...
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_generators.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-macos-latest-3.10-net8.0.trx
CSnakes.Tests-macos-latest-3.10-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
cp "/Users/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.received.txt" "/Users/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "657bc350954200f5d7103a2587de60ae"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, bool> ExampleGenerator(long length);
/// <summary>
/// Invokes the Python function <c>test_normal_generator</c>:
/// <code><![CDATA[
/// def test_normal_generator() -> Generator[str, None, None]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator();
}
"
but was
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "628447fb6935f7e3926b93b678146fc8"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
private PyObject __func_test_generator_sequence;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestGeneratorSequence()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_generator_sequence");
PyObject __underlyingPythonFunc = this.__func_test_generator_sequence;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, "
difference
Showing some of the 3577 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 ...
Expected Value | ... 5 7 b c 3 5 0 9 5 4 2 0 0 f 5 d 7 1 0 3 a ...
Actual Value | ... 2 8 4 4 7 f b 6 9 3 5 f 7 e 3 9 2 6 b 9 3 ...
Expected Code | ... 53 55 98 99 51 53 48 57 53 52 50 48 48 102 53 100 55 49 48 51 97 ...
Actual Code | ... 50 56 52 52 55 102 98 54 57 51 53 102 55 101 51 57 50 54 98 57 51 ...
Difference | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ...
Expected Value | ... d 7 1 0 3 a 2 5 8 7 d e 6 0 a e " u 8 ; \n ...
Actual Value | ... 9 2 6 b 9 3 b 6 7 8 1 4 6 f c 8 " u 8 ; \n ...
Expected Code | ... 100 55 49 48 51 97 50 53 56 55 100 101 54 48 97 101 34 117 56 59 10 ...
Actual Code | ... 57 50 54 98 57 51 98 54 55 56 49 52 54 102 99 56 34 117 56 59 10 ...
Difference | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 ...
Expected Value | ... \s \s \s \s \s \s i n t e r n a l \s T e s t C l ...
Actual Value | ... \s \s \s \s \s p r i v a t e \s P y O b j e c t ...
Expected Code | ... 32 32 32 32 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 ...
Actual Code | ... 32 32 32 32 32 112 114 105 118 97 116 101 32 80 121 79 98 106 101 99 116 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 ...
Expected Value | ... t C l a s s I n t e r n a l ( I L o g g e ...
Actual Value | ... e c t \s _ _ f u n c _ t e s t _ g e n e r ...
Expected Code | ... 116 67 108 97 115 115 73 110 116 101 114 110 97 108 40 73 76 111 103 103 101 ...
Actual Code | ... 101 99 116 32 95 95 102 117 110 99 95 116 101 115 116 95 103 101 110 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 ...
Expected Value | ... r < I P y t h o n E n v i r o n m e n t > ...
Actual Value | ... a t o r _ s e q u e n c e ; \n \n \s \s \s \s \s ...
Expected Code | ... 114 60 73 80 121 116 104 111 110 69 110 118 105 114 111 110 109 101 110 116 62 ...
Actual Code | ... 97 116 111 114 95 115 101 113 117 101 110 99 101 59 10 10 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 ...
Expected Value | ... l o g g e r ) \n \s \s \s \s \s \s \s \s { \n \s \s \s ...
Actual Value | ... \s \s i n t e r n a l \s T e s t C l a s s I ...
Expected Code | ... 108 111 103 103 101 114 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 ...
Actual Code | ... 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 97 115 115 73 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 ...
Expected Value | ... \s \s \s \s \s \s \s \s \s t h i s . l o g g e r \s ...
Actual Value | ... n t e r n a l ( I L o g g e r < I P y t h ...
Expected Code | ... 32 32 32 32 32 32 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 ...
Actual Code | ... 110 116 101 114 110 97 108 40 73 76 111 103 103 101 114 60 73 80 121 116 104 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 ...
Expected Value | ... = \s l o g g e r ; \n \s \s \s \s \s \s \s \s \s \s \s ...
Actual Value | ... o n E n v i r o n m e n t > \s l o g g e r ...
Expected Code | ... 61 32 108 111 103 103 101 114 59 10 32 32 32 32 32 32 32 32 32 32 32 ...
Actual Code | ... 111 110 69 110 118 105 114 111 110 109 101 110 116 62 32 108 111 103 103 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 ...
Expected Value | ... \s u s i n g \s ( G I L . A c q u i r e ( ) ...
Actual Value | ... ) \n \s \s \s \s \s \s \s \s { \n \s \s \s \s \s \s \s \s \s ...
Expected Code | ... 32 117 115 105 110 103 32 40 71 73 76 46 65 99 113 117 105 114 101 40 41 ...
Actual Code | ... 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 ...
Expected Value | ... ) \n \s \s \s \s \s \s \s \s \s \s \s \s { \n \s \s \s \s \s ...
Actual Value | ... \s \s \s t h i s . l o g g e r \s = \s l o g g ...
Expected Code | ... 41 10 32 32 32 32 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 ...
Actual Code | ... 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 61 32 108 111 103 103 ...
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_generators.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-macos-latest-3.12-net8.0.trx
CSnakes.Tests-macos-latest-3.12-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
cp "/Users/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.received.txt" "/Users/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "657bc350954200f5d7103a2587de60ae"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, bool> ExampleGenerator(long length);
/// <summary>
/// Invokes the Python function <c>test_normal_generator</c>:
/// <code><![CDATA[
/// def test_normal_generator() -> Generator[str, None, None]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator();
}
"
but was
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "628447fb6935f7e3926b93b678146fc8"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
private PyObject __func_test_generator_sequence;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestGeneratorSequence()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_generator_sequence");
PyObject __underlyingPythonFunc = this.__func_test_generator_sequence;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, "
difference
Showing some of the 3577 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 ...
Expected Value | ... 5 7 b c 3 5 0 9 5 4 2 0 0 f 5 d 7 1 0 3 a ...
Actual Value | ... 2 8 4 4 7 f b 6 9 3 5 f 7 e 3 9 2 6 b 9 3 ...
Expected Code | ... 53 55 98 99 51 53 48 57 53 52 50 48 48 102 53 100 55 49 48 51 97 ...
Actual Code | ... 50 56 52 52 55 102 98 54 57 51 53 102 55 101 51 57 50 54 98 57 51 ...
Difference | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ...
Expected Value | ... d 7 1 0 3 a 2 5 8 7 d e 6 0 a e " u 8 ; \n ...
Actual Value | ... 9 2 6 b 9 3 b 6 7 8 1 4 6 f c 8 " u 8 ; \n ...
Expected Code | ... 100 55 49 48 51 97 50 53 56 55 100 101 54 48 97 101 34 117 56 59 10 ...
Actual Code | ... 57 50 54 98 57 51 98 54 55 56 49 52 54 102 99 56 34 117 56 59 10 ...
Difference | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 ...
Expected Value | ... \s \s \s \s \s \s i n t e r n a l \s T e s t C l ...
Actual Value | ... \s \s \s \s \s p r i v a t e \s P y O b j e c t ...
Expected Code | ... 32 32 32 32 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 ...
Actual Code | ... 32 32 32 32 32 112 114 105 118 97 116 101 32 80 121 79 98 106 101 99 116 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 ...
Expected Value | ... t C l a s s I n t e r n a l ( I L o g g e ...
Actual Value | ... e c t \s _ _ f u n c _ t e s t _ g e n e r ...
Expected Code | ... 116 67 108 97 115 115 73 110 116 101 114 110 97 108 40 73 76 111 103 103 101 ...
Actual Code | ... 101 99 116 32 95 95 102 117 110 99 95 116 101 115 116 95 103 101 110 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 ...
Expected Value | ... r < I P y t h o n E n v i r o n m e n t > ...
Actual Value | ... a t o r _ s e q u e n c e ; \n \n \s \s \s \s \s ...
Expected Code | ... 114 60 73 80 121 116 104 111 110 69 110 118 105 114 111 110 109 101 110 116 62 ...
Actual Code | ... 97 116 111 114 95 115 101 113 117 101 110 99 101 59 10 10 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 ...
Expected Value | ... l o g g e r ) \n \s \s \s \s \s \s \s \s { \n \s \s \s ...
Actual Value | ... \s \s i n t e r n a l \s T e s t C l a s s I ...
Expected Code | ... 108 111 103 103 101 114 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 ...
Actual Code | ... 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 97 115 115 73 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 ...
Expected Value | ... \s \s \s \s \s \s \s \s \s t h i s . l o g g e r \s ...
Actual Value | ... n t e r n a l ( I L o g g e r < I P y t h ...
Expected Code | ... 32 32 32 32 32 32 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 ...
Actual Code | ... 110 116 101 114 110 97 108 40 73 76 111 103 103 101 114 60 73 80 121 116 104 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 ...
Expected Value | ... = \s l o g g e r ; \n \s \s \s \s \s \s \s \s \s \s \s ...
Actual Value | ... o n E n v i r o n m e n t > \s l o g g e r ...
Expected Code | ... 61 32 108 111 103 103 101 114 59 10 32 32 32 32 32 32 32 32 32 32 32 ...
Actual Code | ... 111 110 69 110 118 105 114 111 110 109 101 110 116 62 32 108 111 103 103 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 ...
Expected Value | ... \s u s i n g \s ( G I L . A c q u i r e ( ) ...
Actual Value | ... ) \n \s \s \s \s \s \s \s \s { \n \s \s \s \s \s \s \s \s \s ...
Expected Code | ... 32 117 115 105 110 103 32 40 71 73 76 46 65 99 113 117 105 114 101 40 41 ...
Actual Code | ... 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 ...
Expected Value | ... ) \n \s \s \s \s \s \s \s \s \s \s \s \s { \n \s \s \s \s \s ...
Actual Value | ... \s \s \s t h i s . l o g g e r \s = \s l o g g ...
Expected Code | ... 41 10 32 32 32 32 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 ...
Actual Code | ... 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 61 32 108 111 103 103 ...
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_generators.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-macos-latest-3.9-net8.0.trx
CSnakes.Tests-macos-latest-3.9-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
cp "/Users/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.received.txt" "/Users/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_generators.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "657bc350954200f5d7103a2587de60ae"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, bool> ExampleGenerator(long length);
/// <summary>
/// Invokes the Python function <c>test_normal_generator</c>:
/// <code><![CDATA[
/// def test_normal_generator() -> Generator[str, None, None]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator();
}
"
but was
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "628447fb6935f7e3926b93b678146fc8"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_example_generator;
private PyObject __func_test_normal_generator;
private PyObject __func_test_generator_sequence;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
// Bind to new functions
this.__func_example_generator = module.GetAttr("example_generator");
this.__func_test_normal_generator = module.GetAttr("test_normal_generator");
this.__func_test_generator_sequence = module.GetAttr("test_generator_sequence");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_example_generator.Dispose();
this.__func_test_normal_generator.Dispose();
this.__func_test_generator_sequence.Dispose();
module.Dispose();
}
public IGeneratorIterator<string, long, bool> ExampleGenerator(long length)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "example_generator");
PyObject __underlyingPythonFunc = this.__func_example_generator;
using PyObject length_pyObject = PyObject.From(length)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(length_pyObject);
return __result_pyObject.As<IGeneratorIterator<string, long, bool>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestNormalGenerator()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_normal_generator");
PyObject __underlyingPythonFunc = this.__func_test_normal_generator;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
public IGeneratorIterator<string, PyObject, PyObject> TestGeneratorSequence()
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "test_generator_sequence");
PyObject __underlyingPythonFunc = this.__func_test_generator_sequence;
using PyObject __result_pyObject = __underlyingPythonFunc.Call();
return __result_pyObject.As<IGeneratorIterator<string, PyObject, PyObject>>();
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>example_generator</c>:
/// <code><![CDATA[
/// def example_generator(length: int) -> Generator[str, int, bool]: ...
/// ]]></code>
/// </summary>
IGeneratorIterator<string, long, "
difference
Showing some of the 3577 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 ...
Expected Value | ... 5 7 b c 3 5 0 9 5 4 2 0 0 f 5 d 7 1 0 3 a ...
Actual Value | ... 2 8 4 4 7 f b 6 9 3 5 f 7 e 3 9 2 6 b 9 3 ...
Expected Code | ... 53 55 98 99 51 53 48 57 53 52 50 48 48 102 53 100 55 49 48 51 97 ...
Actual Code | ... 50 56 52 52 55 102 98 54 57 51 53 102 55 101 51 57 50 54 98 57 51 ...
Difference | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ...
Expected Value | ... d 7 1 0 3 a 2 5 8 7 d e 6 0 a e " u 8 ; \n ...
Actual Value | ... 9 2 6 b 9 3 b 6 7 8 1 4 6 f c 8 " u 8 ; \n ...
Expected Code | ... 100 55 49 48 51 97 50 53 56 55 100 101 54 48 97 101 34 117 56 59 10 ...
Actual Code | ... 57 50 54 98 57 51 98 54 55 56 49 52 54 102 99 56 34 117 56 59 10 ...
Difference | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 ...
Expected Value | ... \s \s \s \s \s \s i n t e r n a l \s T e s t C l ...
Actual Value | ... \s \s \s \s \s p r i v a t e \s P y O b j e c t ...
Expected Code | ... 32 32 32 32 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 ...
Actual Code | ... 32 32 32 32 32 112 114 105 118 97 116 101 32 80 121 79 98 106 101 99 116 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 ...
Expected Value | ... t C l a s s I n t e r n a l ( I L o g g e ...
Actual Value | ... e c t \s _ _ f u n c _ t e s t _ g e n e r ...
Expected Code | ... 116 67 108 97 115 115 73 110 116 101 114 110 97 108 40 73 76 111 103 103 101 ...
Actual Code | ... 101 99 116 32 95 95 102 117 110 99 95 116 101 115 116 95 103 101 110 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 ...
Expected Value | ... r < I P y t h o n E n v i r o n m e n t > ...
Actual Value | ... a t o r _ s e q u e n c e ; \n \n \s \s \s \s \s ...
Expected Code | ... 114 60 73 80 121 116 104 111 110 69 110 118 105 114 111 110 109 101 110 116 62 ...
Actual Code | ... 97 116 111 114 95 115 101 113 117 101 110 99 101 59 10 10 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 ...
Expected Value | ... l o g g e r ) \n \s \s \s \s \s \s \s \s { \n \s \s \s ...
Actual Value | ... \s \s i n t e r n a l \s T e s t C l a s s I ...
Expected Code | ... 108 111 103 103 101 114 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 ...
Actual Code | ... 32 32 105 110 116 101 114 110 97 108 32 84 101 115 116 67 108 97 115 115 73 ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 ...
Expected Value | ... \s \s \s \s \s \s \s \s \s t h i s . l o g g e r \s ...
Actual Value | ... n t e r n a l ( I L o g g e r < I P y t h ...
Expected Code | ... 32 32 32 32 32 32 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 ...
Actual Code | ... 110 116 101 114 110 97 108 40 73 76 111 103 103 101 114 60 73 80 121 116 104 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 ...
Expected Value | ... = \s l o g g e r ; \n \s \s \s \s \s \s \s \s \s \s \s ...
Actual Value | ... o n E n v i r o n m e n t > \s l o g g e r ...
Expected Code | ... 61 32 108 111 103 103 101 114 59 10 32 32 32 32 32 32 32 32 32 32 32 ...
Actual Code | ... 111 110 69 110 118 105 114 111 110 109 101 110 116 62 32 108 111 103 103 101 114 ...
Difference | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 ...
Expected Value | ... \s u s i n g \s ( G I L . A c q u i r e ( ) ...
Actual Value | ... ) \n \s \s \s \s \s \s \s \s { \n \s \s \s \s \s \s \s \s \s ...
Expected Code | ... 32 117 115 105 110 103 32 40 71 73 76 46 65 99 113 117 105 114 101 40 41 ...
Actual Code | ... 41 10 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 32 32 32 32 ...
Difference | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 ...
Expected Value | ... ) \n \s \s \s \s \s \s \s \s \s \s \s \s { \n \s \s \s \s \s ...
Actual Value | ... \s \s \s t h i s . l o g g e r \s = \s l o g g ...
Expected Code | ... 41 10 32 32 32 32 32 32 32 32 32 32 32 32 123 10 32 32 32 32 32 ...
Actual Code | ... 32 32 32 116 104 105 115 46 108 111 103 103 101 114 32 61 32 108 111 103 103 ...
|
build (ubuntu-latest, 3.13)
The 'defaults' channel might have been added implicitly. If this is intentional, add 'defaults' to the 'channels' list. Otherwise, consider setting 'conda-remove-defaults' to 'true'.
|
build (ubuntu-latest, 3.13)
/usr/share/miniconda/lib/python3.12/argparse.py:2006: FutureWarning: `remote_definition` is deprecated and will be removed in 25.9. Use `conda env create --file=URL` instead.
action(self, namespace, argument_values, option_string)
|
build (macos-latest, 3.13)
The 'defaults' channel might have been added implicitly. If this is intentional, add 'defaults' to the 'channels' list. Otherwise, consider setting 'conda-remove-defaults' to 'true'.
|
build (macos-latest, 3.13)
/Users/runner/miniconda3/lib/python3.12/argparse.py:2006: FutureWarning: `remote_definition` is deprecated and will be removed in 25.9. Use `conda env create --file=URL` instead.
action(self, namespace, argument_values, option_string)
|
build (windows-latest, 3.13)
The 'defaults' channel might have been added implicitly. If this is intentional, add 'defaults' to the 'channels' list. Otherwise, consider setting 'conda-remove-defaults' to 'true'.
|
build (windows-latest, 3.11)
The 'defaults' channel might have been added implicitly. If this is intentional, add 'defaults' to the 'channels' list. Otherwise, consider setting 'conda-remove-defaults' to 'true'.
|
build (windows-latest, 3.9)
The 'defaults' channel might have been added implicitly. If this is intentional, add 'defaults' to the 'channels' list. Otherwise, consider setting 'conda-remove-defaults' to 'true'.
|
build (windows-latest, 3.12)
The 'defaults' channel might have been added implicitly. If this is intentional, add 'defaults' to the 'channels' list. Otherwise, consider setting 'conda-remove-defaults' to 'true'.
|
build (windows-latest, 3.10)
The 'defaults' channel might have been added implicitly. If this is intentional, add 'defaults' to the 'channels' list. Otherwise, consider setting 'conda-remove-defaults' to 'true'.
|
build (ubuntu-latest, 3.10)
The 'defaults' channel might have been added implicitly. If this is intentional, add 'defaults' to the 'channels' list. Otherwise, consider setting 'conda-remove-defaults' to 'true'.
|
build (ubuntu-latest, 3.10)
/usr/share/miniconda/lib/python3.12/argparse.py:2006: FutureWarning: `remote_definition` is deprecated and will be removed in 25.9. Use `conda env create --file=URL` instead.
action(self, namespace, argument_values, option_string)
|
build (ubuntu-latest, 3.12)
The 'defaults' channel might have been added implicitly. If this is intentional, add 'defaults' to the 'channels' list. Otherwise, consider setting 'conda-remove-defaults' to 'true'.
|
build (ubuntu-latest, 3.12)
/usr/share/miniconda/lib/python3.12/argparse.py:2006: FutureWarning: `remote_definition` is deprecated and will be removed in 25.9. Use `conda env create --file=URL` instead.
action(self, namespace, argument_values, option_string)
|
build (ubuntu-latest, 3.9)
The 'defaults' channel might have been added implicitly. If this is intentional, add 'defaults' to the 'channels' list. Otherwise, consider setting 'conda-remove-defaults' to 'true'.
|
build (ubuntu-latest, 3.9)
/usr/share/miniconda/lib/python3.12/argparse.py:2006: FutureWarning: `remote_definition` is deprecated and will be removed in 25.9. Use `conda env create --file=URL` instead.
action(self, namespace, argument_values, option_string)
|
build (ubuntu-latest, 3.11)
The 'defaults' channel might have been added implicitly. If this is intentional, add 'defaults' to the 'channels' list. Otherwise, consider setting 'conda-remove-defaults' to 'true'.
|
build (ubuntu-latest, 3.11)
/usr/share/miniconda/lib/python3.12/argparse.py:2006: FutureWarning: `remote_definition` is deprecated and will be removed in 25.9. Use `conda env create --file=URL` instead.
action(self, namespace, argument_values, option_string)
|
build (macos-latest, 3.11)
The 'defaults' channel might have been added implicitly. If this is intentional, add 'defaults' to the 'channels' list. Otherwise, consider setting 'conda-remove-defaults' to 'true'.
|
build (macos-latest, 3.11)
/Users/runner/miniconda3/lib/python3.12/argparse.py:2006: FutureWarning: `remote_definition` is deprecated and will be removed in 25.9. Use `conda env create --file=URL` instead.
action(self, namespace, argument_values, option_string)
|
build (macos-latest, 3.12)
The 'defaults' channel might have been added implicitly. If this is intentional, add 'defaults' to the 'channels' list. Otherwise, consider setting 'conda-remove-defaults' to 'true'.
|
build (macos-latest, 3.12)
/Users/runner/miniconda3/lib/python3.12/argparse.py:2006: FutureWarning: `remote_definition` is deprecated and will be removed in 25.9. Use `conda env create --file=URL` instead.
action(self, namespace, argument_values, option_string)
|
build (macos-latest, 3.10)
The 'defaults' channel might have been added implicitly. If this is intentional, add 'defaults' to the 'channels' list. Otherwise, consider setting 'conda-remove-defaults' to 'true'.
|
build (macos-latest, 3.10)
/Users/runner/miniconda3/lib/python3.12/argparse.py:2006: FutureWarning: `remote_definition` is deprecated and will be removed in 25.9. Use `conda env create --file=URL` instead.
action(self, namespace, argument_values, option_string)
|
build (macos-latest, 3.9)
The 'defaults' channel might have been added implicitly. If this is intentional, add 'defaults' to the 'channels' list. Otherwise, consider setting 'conda-remove-defaults' to 'true'.
|
build (macos-latest, 3.9)
/Users/runner/miniconda3/lib/python3.12/argparse.py:2006: FutureWarning: `remote_definition` is deprecated and will be removed in 25.9. Use `conda env create --file=URL` instead.
action(self, namespace, argument_values, option_string)
|
Artifacts
Produced during runtime
Name | Size | |
---|---|---|
logs-macos-latest-3.10
|
2.22 MB |
|
logs-macos-latest-3.11
|
2.23 MB |
|
logs-macos-latest-3.12
|
2.19 MB |
|
logs-macos-latest-3.13
|
2.72 MB |
|
logs-macos-latest-3.9
|
2.22 MB |
|
logs-ubuntu-latest-3.10
|
2.26 MB |
|
logs-ubuntu-latest-3.11
|
2.25 MB |
|
logs-ubuntu-latest-3.12
|
2.23 MB |
|
logs-ubuntu-latest-3.13
|
2.76 MB |
|
logs-ubuntu-latest-3.9
|
2.25 MB |
|
logs-windows-latest-3.10
|
2.85 MB |
|
logs-windows-latest-3.11
|
2.88 MB |
|
logs-windows-latest-3.12
|
2.85 MB |
|
logs-windows-latest-3.13
|
2.8 MB |
|
logs-windows-latest-3.9
|
2.86 MB |
|
test-results-macos-latest-3.10
|
585 KB |
|
test-results-macos-latest-3.11
|
584 KB |
|
test-results-macos-latest-3.12
|
584 KB |
|
test-results-macos-latest-3.13
|
736 KB |
|
test-results-macos-latest-3.9
|
584 KB |
|
test-results-ubuntu-latest-3.10
|
671 KB |
|
test-results-ubuntu-latest-3.11
|
671 KB |
|
test-results-ubuntu-latest-3.12
|
671 KB |
|
test-results-ubuntu-latest-3.13
|
748 KB |
|
test-results-ubuntu-latest-3.9
|
584 KB |
|
test-results-windows-latest-3.10
|
585 KB |
|
test-results-windows-latest-3.11
|
585 KB |
|
test-results-windows-latest-3.12
|
585 KB |
|
test-results-windows-latest-3.13
|
760 KB |
|
test-results-windows-latest-3.9
|
584 KB |
|