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

PythonInterop_Indexers_Fallback1() public method

public PythonInterop_Indexers_Fallback1 ( ) : void
return void
        public void PythonInterop_Indexers_Fallback1() {
            if (!_driver.RunPython) return;

            var py = Runtime.GetEngine("python");
            ScriptScope scope = py.CreateScope();
            scope.SetVariable("ClrIndexable", typeof(ClrIndexable1));
            py.Execute(@"
import clr
class C(clr.GetPythonType(ClrIndexable)): pass
", scope);

            XAssertOutput(() =>
                Engine.Execute(@"
clr_indexable.to_class.module_eval do
  def [](*args)
    p args
  end

  def []=(*args)
    p args
  end
end

c = C().new
p c[1, 2]

c[3, 4] = 5
p c.Value
", scope), @"
3
23
");
        }
Tests