-
Notifications
You must be signed in to change notification settings - Fork 665
DYN-8088 DSCore.List.Flatten does not work in PythonNet3 #16761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 = @" | ||
|
|
@@ -344,6 +337,36 @@ import DSCore | |
| } | ||
| } | ||
|
|
||
| [Test] | ||
| public void TryDecode_ConvertsNestedPythonListsToClrLists() | ||
| { | ||
| 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(); | ||
|
||
| 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); | ||
|
|
||
There was a problem hiding this comment.
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.Flattenis 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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now addressed