def test_Unbounded_lifting(self):
        wrapped = Binding(None)
        wrapper = DescriptorDecoratorBase(wrapped)

        result = _lifted_desc_results(wrapped, wrapper, None, object)

        self.assertIs(result, wrapper)
Beispiel #2
0
    def test_forced_setting_with_binding_descriptor(self):
        instance = mocks.ClassWithDescriptor(ForcedSet(Binding(
                mocks.Descriptor())))

        Setter.forced(instance, attrname, 0, binding=True)

        self.assertEqual(getattr(instance, attrname), 0)
    def test_with_binding_descriptor(self):
        instance = mocks.ClassWithDescriptor(Binding(mocks.Descriptor()))
        cls = type(instance)

        result = get_descriptor_from(instance, attrname)

        self.assertIs(result, cls.__dict__[attrname])
    def setUp(self):
        self.decor = Binding(mocks.Descriptor())
        self.instance = mocks.ClassWithDescriptor(self.decor)
        self.Class = type(self.instance)

        self.instance.attr = 5
 def setUp(self):
     self.decor = DescriptorDecoratorBase(Binding(mocks.Descriptor()))
     self.Class = type(mocks.ClassWithDescriptor(self.decor))
     self.instance = self.Class()
     self.instance.attr = 5
    def test_with_binding_descriptor(self):
        cls = type(mocks.ClassWithDescriptor(Binding(mocks.Descriptor())))

        result = get_descriptor(cls, attrname)

        self.assertIs(result, cls.__dict__[attrname])