コード例 #1
0
ファイル: test_property.py プロジェクト: jmerle/pythonnet
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"
コード例 #2
0
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
コード例 #3
0
ファイル: test_property.py プロジェクト: brudo/pythonnet-1
    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
コード例 #4
0
ファイル: test_property.py プロジェクト: jmerle/pythonnet
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
コード例 #5
0
    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)
コード例 #6
0
    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)
コード例 #7
0
ファイル: test_property.py プロジェクト: zerodeku/pythonnet
    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)
コード例 #8
0
 def test():
     object = PropertyTest()
     object.PublicProperty = "spam"
コード例 #9
0
 def test():
     object = PropertyTest()
     object.PublicProperty = "spam"
コード例 #10
0
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"
コード例 #11
0
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"