Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement the Starlark index expression assignment operation (#497)
* CSL3-2071 CSL3-2108 - Case Insensitive headers test * Failing test demonstrating issue with assignment of d["key"] = "one" throwing an exception. The error message is: Error: can only assign an element in a dictionary or a list, not in a 'MutableStruct'. Let's make the tests pass! * We introduce StarlarkSetIndexable to allow setIndex, similar to StarlarkIndexable. We follow the exact same interface and modifications for StarlarkIndexable and update the error message to signify that we now support setIndex on dictionaries, lists, and any implementation of StarlarkSetIndexable. We also support the equivalent StarlarkIndexable.Threaded interface for StarlarkSetIndexable, similary called StarlarkSetIndexable.Threaded. * Update tests to support usage pattern * Update LarkyIndexable to support __setitem__ and implement the new StarlarkSetIndexable(.Threaded) interface * And now, we do not need StarlarkMapping any longer since we can fulfill the exact same interface with LarkyMapping. Delete StarlarkMapping and move the functionality to LarkyMapping * Fix incorrect test syntax -- there is no .size() in Python, only len(dict) for cardinality checks * we do not have a base itemview class in larky, so we cannot compare classes to primitives in larky (as we would do in python). as a result, we have to return a raw list on the view instead of an actual view * We make the final modification to get the test to pass! --------- Co-authored-by: Sasha Kochniev <[email protected]>
- Loading branch information