def test_property_descriptor_wrong_type(): """Test setting a property using a value of the wrong type.""" # Will attempt to implicitly convert "spam" to int, and fail, resulting in ValueError with pytest.raises(ValueError): ob = PropertyTest() ob.PublicProperty = "spam"
def test_public_instance_property(): """Test public instance properties.""" ob = PropertyTest() assert ob.PublicProperty == 0 ob.PublicProperty = 1 assert ob.PublicProperty == 1 with pytest.raises(TypeError): del PropertyTest().PublicProperty
def test_public_instance_property(self): """Test public instance properties.""" ob = PropertyTest() self.assertTrue(ob.PublicProperty == 0) ob.PublicProperty = 1 self.assertTrue(ob.PublicProperty == 1) with self.assertRaises(TypeError): del PropertyTest().PublicProperty
def testPublicInstanceProperty(self): """Test public instance properties.""" object = PropertyTest() self.failUnless(object.PublicProperty == 0) object.PublicProperty = 1 self.failUnless(object.PublicProperty == 1) def test(): del PropertyTest().PublicProperty self.failUnlessRaises(TypeError, test)
def testPublicInstanceProperty(self): """Test public instance properties.""" object = PropertyTest(); self.failUnless(object.PublicProperty == 0) object.PublicProperty = 1 self.failUnless(object.PublicProperty == 1) def test(): del PropertyTest().PublicProperty self.failUnlessRaises(TypeError, test)
def testPublicInstanceProperty(self): """Test public instance properties.""" object = PropertyTest(); self.assertTrue(object.PublicProperty == 0) object.PublicProperty = 1 self.assertTrue(object.PublicProperty == 1) def test(): del PropertyTest().PublicProperty self.assertRaises(TypeError, test)
def test(): object = PropertyTest() object.PublicProperty = "spam"
def test_property_descriptor_wrong_type(): """Test setting a property using a value of the wrong type.""" with pytest.raises(TypeError): ob = PropertyTest() ob.PublicProperty = "spam"