def test_forced_setting_with_binding_descriptor(self): instance = mocks.ClassWithDescriptor( mocks.ForcedSet(mocks.Binding(mocks.Descriptor()))) Setter.forced(instance, attrname, 0, binding=True) self.assertEqual(getattr(instance, attrname), 0)
def test_with_binding_descriptor(self): cls = type(mocks.ClassWithDescriptor(mocks.Binding( mocks.Descriptor()))) result = _find_descriptor(cls, attrname) self.assertIs(result, cls.__dict__[attrname])
def test_with_binding_descriptor(self): instance = mocks.ClassWithDescriptor(mocks.Binding(mocks.Descriptor())) cls = type(instance) result = get_descriptor_from(instance, attrname) self.assertIs(result, cls.__dict__[attrname])
def test_Unbounded_lifting(self): wrapped = mocks.Binding(None) wrapper = DescriptorDecoratorBase(wrapped) result = _lifted_desc_results(wrapped, wrapper, None, object) self.assertIs(result.descriptor, wrapper)
def setUp(self): self.decor = DescriptorDecoratorBase(mocks.Binding(mocks.Descriptor())) self.Class = type(mocks.ClassWithDescriptor(self.decor))