Ejemplo n.º 1
0
    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])
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
 def setUp(self):
     self.decor = DescriptorDecoratorBase(mocks.Binding(mocks.Descriptor()))
     self.Class = type(mocks.ClassWithDescriptor(self.decor))