IronRuby.Tests.Tests.PythonInterop_NamedIndexers1 C# (CSharp) Method

PythonInterop_NamedIndexers1() public method

We convert a call to a setter with multiple parameters to a GetMember + SetIndex. This makes indexed properties on foreign meta-objects work.
public PythonInterop_NamedIndexers1 ( ) : void
return void
        public void PythonInterop_NamedIndexers1() {
            if (!_driver.RunPython) return;
            
            var py = Runtime.GetEngine("python");
            ScriptScope scope = py.CreateScope();
            py.Execute(@"
class C:
  def __init__(self):
    self.Foo = Indexable()
  
class Indexable:
  def __setitem__(self, index, value):
    print index, value
", scope);

            AssertOutput(() =>
                Engine.Execute(@"
c = C().new
c.foo[1, 2] = 3
c.Foo[4, 5] = 6
c.send(:foo=, 7, 8, 9)
c.send(:Foo=, 10, 11, 12)
", scope), @"
(1, 2) 3
(4, 5) 6
(7, 8) 9
(10, 11) 12
");
        }
Tests