Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions test/Libraries/DynamoPythonTests/PythonEvalTestsWithLibraries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,7 @@ from FFITarget import DummyMath
}
}

/// <summary>
/// PythonNet3 vs DesignScript list interop issue:
/// DSCore list ops expect DS lists; PythonNet passes .NET lists, causing wrong overloads/comparers.
/// Quarantined until parity fix.
/// </summary>
[Test]
[Category("Failure")]
[Category("TechDebt")]
public void TestListDecoding()
{
string code = @"
Expand Down Expand Up @@ -344,6 +337,36 @@ import DSCore
}
}

[Test]
public void TryDecode_ConvertsNestedPythonListsToClrLists()
Comment on lines +340 to +341
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a test case that verifies the behavior when List.Flatten is called with different depth parameters (e.g., 0, 1) to ensure the fix handles various flattening levels correctly, not just the complete flatten with -1.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now addressed

{
string code = @"
import clr
clr.AddReference('DSCoreNodes')
from DSCore import List

data = [[1, 2, 3], [4, 5, 6]]
OUT = data, List.Flatten(data, -1)
";
var empty = new ArrayList();
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The variable name 'empty' is misleading since it's used as an argument to pythonEvaluator but doesn't reflect its purpose. Consider renaming to something like 'emptyInputs' or 'emptyParameters' to clarify its role in the evaluator call.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now addressed

var expected = new ArrayList
{
new ArrayList
{
new ArrayList { 1, 2, 3 },
new ArrayList { 4, 5, 6 }
},
new ArrayList { 1, 2, 3, 4, 5, 6 }
};

foreach (var pythonEvaluator in Evaluators)
{
var result = pythonEvaluator(code, empty, empty);
Assert.That(result, Is.InstanceOf<IEnumerable>());
CollectionAssert.AreEqual(expected, result as IEnumerable);
}
}

private void DictionaryAssert(IDictionary expected, IDictionary actual)
{
Assert.AreEqual(expected.Count, actual.Count);
Expand Down
Loading