def test_protected_static_field(): """Test protected static fields.""" ob = FieldTest() assert FieldTest.ProtectedStaticField == 0 FieldTest.ProtectedStaticField = 1 assert FieldTest.ProtectedStaticField == 1 assert ob.ProtectedStaticField == 1 ob.ProtectedStaticField = 0 assert ob.ProtectedStaticField == 0 with pytest.raises(TypeError): del FieldTest.ProtectedStaticField with pytest.raises(TypeError): del FieldTest().ProtectedStaticField
def test_protected_static_field(self): """Test protected static fields.""" ob = FieldTest() self.assertTrue(FieldTest.ProtectedStaticField == 0) FieldTest.ProtectedStaticField = 1 self.assertTrue(FieldTest.ProtectedStaticField == 1) self.assertTrue(ob.ProtectedStaticField == 1) ob.ProtectedStaticField = 0 self.assertTrue(ob.ProtectedStaticField == 0) with self.assertRaises(TypeError): del FieldTest.ProtectedStaticField with self.assertRaises(TypeError): del FieldTest().ProtectedStaticField
def testProtectedStaticField(self): """Test protected static fields.""" object = FieldTest() self.failUnless(FieldTest.ProtectedStaticField == 0) FieldTest.ProtectedStaticField = 1 self.failUnless(FieldTest.ProtectedStaticField == 1) self.failUnless(object.ProtectedStaticField == 1) object.ProtectedStaticField = 0 self.failUnless(object.ProtectedStaticField == 0) def test(): del FieldTest.ProtectedStaticField self.failUnlessRaises(TypeError, test) def test(): del FieldTest().ProtectedStaticField self.failUnlessRaises(TypeError, test)
def testProtectedStaticField(self): """Test protected static fields.""" object = FieldTest(); self.failUnless(FieldTest.ProtectedStaticField == 0) FieldTest.ProtectedStaticField = 1 self.failUnless(FieldTest.ProtectedStaticField == 1) self.failUnless(object.ProtectedStaticField == 1) object.ProtectedStaticField = 0 self.failUnless(object.ProtectedStaticField == 0) def test(): del FieldTest.ProtectedStaticField self.failUnlessRaises(TypeError, test) def test(): del FieldTest().ProtectedStaticField self.failUnlessRaises(TypeError, test)
def testProtectedStaticField(self): """Test protected static fields.""" object = FieldTest() self.assertTrue(FieldTest.ProtectedStaticField == 0) FieldTest.ProtectedStaticField = 1 self.assertTrue(FieldTest.ProtectedStaticField == 1) self.assertTrue(object.ProtectedStaticField == 1) object.ProtectedStaticField = 0 self.assertTrue(object.ProtectedStaticField == 0) def test(): del FieldTest.ProtectedStaticField self.assertRaises(TypeError, test) def test(): del FieldTest().ProtectedStaticField self.assertRaises(TypeError, test)