示例#1
0
def test_protected_static_property():
    """Test protected static properties."""
    ob = PropertyTest()

    assert PropertyTest.ProtectedStaticProperty == 0
    PropertyTest.ProtectedStaticProperty = 1
    assert PropertyTest.ProtectedStaticProperty == 1

    assert ob.ProtectedStaticProperty == 1
    ob.ProtectedStaticProperty = 0
    assert ob.ProtectedStaticProperty == 0

    with pytest.raises(TypeError):
        del PropertyTest.ProtectedStaticProperty

    with pytest.raises(TypeError):
        del PropertyTest().ProtectedStaticProperty
示例#2
0
    def test_protected_static_property(self):
        """Test protected static properties."""
        ob = PropertyTest()

        self.assertTrue(PropertyTest.ProtectedStaticProperty == 0)
        PropertyTest.ProtectedStaticProperty = 1
        self.assertTrue(PropertyTest.ProtectedStaticProperty == 1)

        self.assertTrue(ob.ProtectedStaticProperty == 1)
        ob.ProtectedStaticProperty = 0
        self.assertTrue(ob.ProtectedStaticProperty == 0)

        with self.assertRaises(TypeError):
            del PropertyTest.ProtectedStaticProperty

        with self.assertRaises(TypeError):
            del PropertyTest().ProtectedStaticProperty
示例#3
0
def test_protected_static_property():
    """Test protected static properties."""
    ob = PropertyTest()

    assert PropertyTest.ProtectedStaticProperty == 0
    PropertyTest.ProtectedStaticProperty = 1
    assert PropertyTest.ProtectedStaticProperty == 1

    assert ob.ProtectedStaticProperty == 1
    ob.ProtectedStaticProperty = 0
    assert ob.ProtectedStaticProperty == 0

    with pytest.raises(TypeError):
        del PropertyTest.ProtectedStaticProperty

    with pytest.raises(TypeError):
        del PropertyTest().ProtectedStaticProperty
示例#4
0
    def testProtectedStaticProperty(self):
        """Test protected static properties."""
        object = PropertyTest()

        self.failUnless(PropertyTest.ProtectedStaticProperty == 0)
        PropertyTest.ProtectedStaticProperty = 1
        self.failUnless(PropertyTest.ProtectedStaticProperty == 1)

        self.failUnless(object.ProtectedStaticProperty == 1)
        object.ProtectedStaticProperty = 0
        self.failUnless(object.ProtectedStaticProperty == 0)

        def test():
            del PropertyTest.ProtectedStaticProperty

        self.failUnlessRaises(TypeError, test)

        def test():
            del PropertyTest().ProtectedStaticProperty

        self.failUnlessRaises(TypeError, test)
示例#5
0
    def testProtectedStaticProperty(self):
        """Test protected static properties."""
        object = PropertyTest();

        self.failUnless(PropertyTest.ProtectedStaticProperty == 0)
        PropertyTest.ProtectedStaticProperty = 1
        self.failUnless(PropertyTest.ProtectedStaticProperty == 1)

        self.failUnless(object.ProtectedStaticProperty == 1)
        object.ProtectedStaticProperty = 0
        self.failUnless(object.ProtectedStaticProperty == 0)

        def test():
            del PropertyTest.ProtectedStaticProperty

        self.failUnlessRaises(TypeError, test)

        def test():
            del PropertyTest().ProtectedStaticProperty

        self.failUnlessRaises(TypeError, test)
示例#6
0
    def testProtectedStaticProperty(self):
        """Test protected static properties."""
        object = PropertyTest();

        self.assertTrue(PropertyTest.ProtectedStaticProperty == 0)
        PropertyTest.ProtectedStaticProperty = 1
        self.assertTrue(PropertyTest.ProtectedStaticProperty == 1)

        self.assertTrue(object.ProtectedStaticProperty == 1)
        object.ProtectedStaticProperty = 0
        self.assertTrue(object.ProtectedStaticProperty == 0)

        def test():
            del PropertyTest.ProtectedStaticProperty

        self.assertRaises(TypeError, test)

        def test():
            del PropertyTest().ProtectedStaticProperty

        self.assertRaises(TypeError, test)