Ejemplo n.º 1
0
    def testObjectField(self):
        """Test object fields."""
        object = FieldTest()
        self.failUnless(object.ObjectField == None)

        object.ObjectField = System.String("spam")
        self.failUnless(object.ObjectField == "spam")

        object.ObjectField = System.Int32(1)
        self.failUnless(object.ObjectField == 1)

        object.ObjectField = None
        self.failUnless(object.ObjectField == None)
Ejemplo n.º 2
0
def test_object_field():
    """Test ob fields."""
    ob = FieldTest()
    assert ob.ObjectField is None

    ob.ObjectField = System.String("spam")
    assert ob.ObjectField == "spam"

    ob.ObjectField = System.Int32(1)
    assert ob.ObjectField == 1

    ob.ObjectField = None
    assert ob.ObjectField is None
Ejemplo n.º 3
0
    def testObjectField(self):
        """Test object fields."""
        object = FieldTest()
        self.failUnless(object.ObjectField == None)

        object.ObjectField = System.String("spam")
        self.failUnless(object.ObjectField == "spam")

        object.ObjectField = System.Int32(1)
        self.failUnless(object.ObjectField == 1)

        object.ObjectField = None
        self.failUnless(object.ObjectField == None)
Ejemplo n.º 4
0
def test_object_field():
    """Test ob fields."""
    ob = FieldTest()
    assert ob.ObjectField is None

    ob.ObjectField = System.String("spam")
    assert ob.ObjectField == "spam"

    ob.ObjectField = System.Int32(1)
    assert ob.ObjectField == 1

    ob.ObjectField = None
    assert ob.ObjectField is None
Ejemplo n.º 5
0
    def test_object_field(self):
        """Test ob fields."""
        ob = FieldTest()
        self.assertTrue(ob.ObjectField is None)

        ob.ObjectField = System.String("spam")
        self.assertTrue(ob.ObjectField == "spam")

        ob.ObjectField = System.Int32(1)
        self.assertTrue(ob.ObjectField == 1)

        ob.ObjectField = None
        self.assertTrue(ob.ObjectField is None)
Ejemplo n.º 6
0
def test_nullable_field():
    """Test nullable fields."""
    ob = FieldTest()

    ob.StringField = None
    assert ob.StringField is None

    ob.ObjectField = None
    assert ob.ObjectField is None

    ob.SpamField = None
    assert ob.SpamField is None

    # Primitive types and enums should not be set to null.

    with pytest.raises(TypeError):
        FieldTest().Int32Field = None

    with pytest.raises(TypeError):
        FieldTest().EnumField = None
Ejemplo n.º 7
0
def test_nullable_field():
    """Test nullable fields."""
    ob = FieldTest()

    ob.StringField = None
    assert ob.StringField is None

    ob.ObjectField = None
    assert ob.ObjectField is None

    ob.SpamField = None
    assert ob.SpamField is None

    # Primitive types and enums should not be set to null.

    with pytest.raises(TypeError):
        FieldTest().Int32Field = None

    with pytest.raises(TypeError):
        FieldTest().EnumField = None
Ejemplo n.º 8
0
    def test_nullable_field(self):
        """Test nullable fields."""
        ob = FieldTest()

        ob.StringField = None
        self.assertTrue(ob.StringField is None)

        ob.ObjectField = None
        self.assertTrue(ob.ObjectField is None)

        ob.SpamField = None
        self.assertTrue(ob.SpamField is None)

        # Primitive types and enums should not be set to null.

        with self.assertRaises(TypeError):
            FieldTest().Int32Field = None

        with self.assertRaises(TypeError):
            FieldTest().EnumField = None
Ejemplo n.º 9
0
    def testNullableField(self):
        """Test nullable fields."""
        object = FieldTest()

        object.StringField = None
        self.failUnless(object.StringField == None)

        object.ObjectField = None
        self.failUnless(object.ObjectField == None)

        object.SpamField = None
        self.failUnless(object.SpamField == None)

        # Primitive types and enums should not be set to null.

        def test():
            FieldTest().Int32Field = None

        self.failUnlessRaises(TypeError, test)

        def test():
            FieldTest().EnumField = None

        self.failUnlessRaises(TypeError, test)
Ejemplo n.º 10
0
    def testNullableField(self):
        """Test nullable fields."""
        object = FieldTest()

        object.StringField = None
        self.failUnless(object.StringField == None)

        object.ObjectField = None
        self.failUnless(object.ObjectField == None)

        object.SpamField = None
        self.failUnless(object.SpamField == None)

        # Primitive types and enums should not be set to null.

        def test():
            FieldTest().Int32Field = None

        self.failUnlessRaises(TypeError, test)

        def test():
            FieldTest().EnumField = None

        self.failUnlessRaises(TypeError, test)