Exemplo n.º 1
0
def test_string_field():
    """Test string fields."""
    ob = FieldTest()
    assert ob.StringField == "spam"

    ob.StringField = "eggs"
    assert ob.StringField == "eggs"
Exemplo n.º 2
0
    def testStringField(self):
        """Test string fields."""
        object = FieldTest()
        self.failUnless(object.StringField == "spam")

        object.StringField = "eggs"
        self.failUnless(object.StringField == "eggs")
Exemplo n.º 3
0
    def testStringField(self):
        """Test string fields."""
        object = FieldTest()
        self.failUnless(object.StringField == "spam")

        object.StringField = "eggs"
        self.failUnless(object.StringField == "eggs")        
Exemplo n.º 4
0
def test_string_field():
    """Test string fields."""
    ob = FieldTest()
    assert ob.StringField == "spam"

    ob.StringField = "eggs"
    assert ob.StringField == "eggs"
Exemplo n.º 5
0
    def test_string_field(self):
        """Test string fields."""
        ob = FieldTest()
        self.assertTrue(ob.StringField == "spam")

        ob.StringField = "eggs"
        self.assertTrue(ob.StringField == "eggs")
Exemplo n.º 6
0
    def testStringField(self):
        """Test string fields."""
        object = FieldTest()
        self.assertTrue(object.StringField == "spam")

        object.StringField = "eggs"
        self.assertTrue(object.StringField == "eggs")
Exemplo 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
Exemplo n.º 8
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
Exemplo n.º 9
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
Exemplo 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)
Exemplo n.º 11
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)