public void CallInheritedClrMethod_WithExtraPythonBase()
        {
            var    instance = new Inherited().ToPython();
            string result   = instance.InvokeMethod(nameof(PythonWrapperBase.WrapperBaseMethod)).As <string>();

            Assert.AreEqual(result, nameof(PythonWrapperBase.WrapperBaseMethod));
        }
        public void ExtraBase_PassesInstanceCheck()
        {
            var  inherited         = new Inherited();
            bool properlyInherited = PyIsInstance(inherited, ExtraBaseTypeProvider.ExtraBase);

            Assert.IsTrue(properlyInherited);
        }
        public void InheritingWithExtraBase_CreatesNewClass()
        {
            PyObject a              = ExtraBaseTypeProvider.ExtraBase;
            var      inherited      = new Inherited();
            PyObject inheritedClass = inherited.ToPython().GetAttr("__class__");

            Assert.IsFalse(PythonReferenceComparer.Instance.Equals(a, inheritedClass));
        }
        public void CallExtraBaseMethod()
        {
            var instance = new Inherited();

            using var scope = Py.CreateScope();
            scope.Set(nameof(instance), instance);
            int actual = instance.ToPython().InvokeMethod("callVirt").As <int>();

            Assert.AreEqual(expected: Inherited.OverridenVirtValue, actual);
        }
        public void SetAdHocAttributes_WhenExtraBasePresent()
        {
            var instance = new Inherited();

            using var scope = Py.CreateScope();
            scope.Set(nameof(instance), instance);
            scope.Exec($"super({nameof(instance)}.__class__, {nameof(instance)}).set_x_to_42()");
            int actual = scope.Eval <int>($"{nameof(instance)}.{nameof(Inherited.XProp)}");

            Assert.AreEqual(expected: Inherited.X, actual);
        }