Пример #1
0
    def test_int32_field(self):
        """Test int32 fields."""
        ob = FieldTest()
        self.assertTrue(ob.Int32Field == 0)

        ob.Int32Field = 1
        self.assertTrue(ob.Int32Field == 1)
Пример #2
0
def test_double_field():
    """Test double fields."""
    ob = FieldTest()
    assert ob.DoubleField == 0.0

    ob.DoubleField = 1.1
    assert ob.DoubleField == 1.1
Пример #3
0
def test_string_field():
    """Test string fields."""
    ob = FieldTest()
    assert ob.StringField == "spam"

    ob.StringField = "eggs"
    assert ob.StringField == "eggs"
Пример #4
0
def test_uint16_field():
    """Test uint16 fields."""
    ob = FieldTest()
    assert ob.UInt16Field == 0

    ob.UInt16Field = 1
    assert ob.UInt16Field == 1
Пример #5
0
def test_uint64_field():
    """Test uint64 fields."""
    ob = FieldTest()
    assert ob.UInt64Field == 0

    ob.UInt64Field = 1
    assert ob.UInt64Field == 1
Пример #6
0
    def test_double_field(self):
        """Test double fields."""
        ob = FieldTest()
        self.assertTrue(ob.DoubleField == 0.0)

        ob.DoubleField = 1.1
        self.assertTrue(ob.DoubleField == 1.1)
Пример #7
0
    def test_string_field(self):
        """Test string fields."""
        ob = FieldTest()
        self.assertTrue(ob.StringField == "spam")

        ob.StringField = "eggs"
        self.assertTrue(ob.StringField == "eggs")
Пример #8
0
    def testEnumField(self):
        """Test enum fields."""
        object = FieldTest()
        self.assertTrue(object.EnumField == ShortEnum.Zero)

        object.EnumField = ShortEnum.One
        self.assertTrue(object.EnumField == ShortEnum.One)
Пример #9
0
    def testByteField(self):
        """Test byte fields."""
        object = FieldTest()
        self.assertTrue(object.ByteField == 0)

        object.ByteField = 1
        self.assertTrue(object.ByteField == 1)
Пример #10
0
    def testDecimalField(self):
        """Test decimal fields."""
        object = FieldTest()
        self.assertTrue(object.DecimalField == System.Decimal(0))

        object.DecimalField = System.Decimal(1)
        self.assertTrue(object.DecimalField == System.Decimal(1))
Пример #11
0
    def testStringField(self):
        """Test string fields."""
        object = FieldTest()
        self.assertTrue(object.StringField == "spam")

        object.StringField = "eggs"
        self.assertTrue(object.StringField == "eggs")
Пример #12
0
    def testDoubleField(self):
        """Test double fields."""
        object = FieldTest()
        self.assertTrue(object.DoubleField == 0.0)

        object.DoubleField = 1.1
        self.assertTrue(object.DoubleField == 1.1)
Пример #13
0
    def testSingleField(self):
        """Test single fields."""
        object = FieldTest()
        self.assertTrue(object.SingleField == 0.0)

        object.SingleField = 1.1
        self.assertTrue(object.SingleField == 1.1)
Пример #14
0
    def testUInt64Field(self):
        """Test uint64 fields."""
        object = FieldTest()
        self.assertTrue(object.UInt64Field == 0)

        object.UInt64Field = 1
        self.assertTrue(object.UInt64Field == 1)
Пример #15
0
    def test_uint64_field(self):
        """Test uint64 fields."""
        ob = FieldTest()
        self.assertTrue(ob.UInt64Field == 0)

        ob.UInt64Field = 1
        self.assertTrue(ob.UInt64Field == 1)
Пример #16
0
    def testInt32Field(self):
        """Test int32 fields."""
        object = FieldTest()
        self.assertTrue(object.Int32Field == 0)

        object.Int32Field = 1
        self.assertTrue(object.Int32Field == 1)
Пример #17
0
    def test_single_field(self):
        """Test single fields."""
        ob = FieldTest()
        self.assertTrue(ob.SingleField == 0.0)

        ob.SingleField = 1.1
        self.assertTrue(ob.SingleField == 1.1)
Пример #18
0
    def testUInt64Field(self):
        """Test uint64 fields."""
        object = FieldTest()
        self.assertTrue(object.UInt64Field == 0)

        object.UInt64Field = 1
        self.assertTrue(object.UInt64Field == 1)
Пример #19
0
    def test_decimal_field(self):
        """Test decimal fields."""
        ob = FieldTest()
        self.assertTrue(ob.DecimalField == System.Decimal(0))

        ob.DecimalField = System.Decimal(1)
        self.assertTrue(ob.DecimalField == System.Decimal(1))
Пример #20
0
    def testSingleField(self):
        """Test single fields."""
        object = FieldTest()
        self.assertTrue(object.SingleField == 0.0)

        object.SingleField = 1.1
        self.assertTrue(object.SingleField == 1.1)
Пример #21
0
def test_byte_field():
    """Test byte fields."""
    ob = FieldTest()
    assert ob.ByteField == 0

    ob.ByteField = 1
    assert ob.ByteField == 1
Пример #22
0
    def testDoubleField(self):
        """Test double fields."""
        object = FieldTest()
        self.assertTrue(object.DoubleField == 0.0)

        object.DoubleField = 1.1
        self.assertTrue(object.DoubleField == 1.1)
Пример #23
0
def test_uint32_field():
    """Test uint32 fields."""
    ob = FieldTest()
    assert ob.UInt32Field == 0

    ob.UInt32Field = 1
    assert ob.UInt32Field == 1
Пример #24
0
    def testEnumField(self):
        """Test enum fields."""
        object = FieldTest()
        self.assertTrue(object.EnumField == ShortEnum.Zero)

        object.EnumField = ShortEnum.One
        self.assertTrue(object.EnumField == ShortEnum.One)
Пример #25
0
def test_single_field():
    """Test single fields."""
    ob = FieldTest()
    assert ob.SingleField == 0.0

    ob.SingleField = 1.1
    assert ob.SingleField == 1.1
Пример #26
0
    def test_byte_field(self):
        """Test byte fields."""
        ob = FieldTest()
        self.assertTrue(ob.ByteField == 0)

        ob.ByteField = 1
        self.assertTrue(ob.ByteField == 1)
Пример #27
0
def test_decimal_field():
    """Test decimal fields."""
    ob = FieldTest()
    assert ob.DecimalField == System.Decimal(0)

    ob.DecimalField = System.Decimal(1)
    assert ob.DecimalField == System.Decimal(1)
Пример #28
0
    def testByteField(self):
        """Test byte fields."""
        object = FieldTest()
        self.failUnless(object.ByteField == 0)

        object.ByteField = 1
        self.failUnless(object.ByteField == 1)
Пример #29
0
    def testByteField(self):
        """Test byte fields."""
        object = FieldTest()
        self.assertTrue(object.ByteField == 0)

        object.ByteField = 1
        self.assertTrue(object.ByteField == 1)
Пример #30
0
    def testInt32Field(self):
        """Test int32 fields."""
        object = FieldTest()
        self.assertTrue(object.Int32Field == 0)

        object.Int32Field = 1
        self.assertTrue(object.Int32Field == 1)
Пример #31
0
    def testDoubleField(self):
        """Test double fields."""
        object = FieldTest()
        self.failUnless(object.DoubleField == 0.0)

        object.DoubleField = 1.1
        self.failUnless(object.DoubleField == 1.1)
Пример #32
0
    def testDecimalField(self):
        """Test decimal fields."""
        object = FieldTest()
        self.failUnless(object.DecimalField == System.Decimal(0))

        object.DecimalField = System.Decimal(1)
        self.failUnless(object.DecimalField == System.Decimal(1))
Пример #33
0
def test_uint64_field():
    """Test uint64 fields."""
    ob = FieldTest()
    assert ob.UInt64Field == 0

    ob.UInt64Field = 1
    assert ob.UInt64Field == 1
Пример #34
0
def test_double_field():
    """Test double fields."""
    ob = FieldTest()
    assert ob.DoubleField == 0.0

    ob.DoubleField = 1.1
    assert ob.DoubleField == 1.1
Пример #35
0
def test_decimal_field():
    """Test decimal fields."""
    ob = FieldTest()
    assert ob.DecimalField == System.Decimal(0)

    ob.DecimalField = System.Decimal(1)
    assert ob.DecimalField == System.Decimal(1)
Пример #36
0
def test_uint16_field():
    """Test uint16 fields."""
    ob = FieldTest()
    assert ob.UInt16Field == 0

    ob.UInt16Field = 1
    assert ob.UInt16Field == 1
Пример #37
0
    def testStringField(self):
        """Test string fields."""
        object = FieldTest()
        self.failUnless(object.StringField == "spam")

        object.StringField = "eggs"
        self.failUnless(object.StringField == "eggs")        
Пример #38
0
    def testEnumField(self):
        """Test enum fields."""
        object = FieldTest()
        self.failUnless(object.EnumField == ShortEnum.Zero)

        object.EnumField = ShortEnum.One
        self.failUnless(object.EnumField == ShortEnum.One)
Пример #39
0
    def testDoubleField(self):
        """Test double fields."""
        object = FieldTest()
        self.failUnless(object.DoubleField == 0.0)

        object.DoubleField = 1.1
        self.failUnless(object.DoubleField == 1.1)
Пример #40
0
    def testDecimalField(self):
        """Test decimal fields."""
        object = FieldTest()
        self.failUnless(object.DecimalField == System.Decimal(0))

        object.DecimalField = System.Decimal(1)
        self.failUnless(object.DecimalField == System.Decimal(1))
Пример #41
0
    def testSingleField(self):
        """Test single fields."""
        object = FieldTest()
        self.failUnless(object.SingleField == 0.0)

        object.SingleField = 1.1
        self.failUnless(object.SingleField == 1.1)
Пример #42
0
    def testUInt64Field(self):
        """Test uint64 fields."""
        object = FieldTest()
        self.failUnless(object.UInt64Field == 0)

        object.UInt64Field = 1
        self.failUnless(object.UInt64Field == 1)
Пример #43
0
    def testInt32Field(self):
        """Test int32 fields."""
        object = FieldTest()
        self.failUnless(object.Int32Field == 0)

        object.Int32Field = 1
        self.failUnless(object.Int32Field == 1)
Пример #44
0
    def testEnumField(self):
        """Test enum fields."""
        object = FieldTest()
        self.failUnless(object.EnumField == ShortEnum.Zero)

        object.EnumField = ShortEnum.One
        self.failUnless(object.EnumField == ShortEnum.One)
Пример #45
0
    def testByteField(self):
        """Test byte fields."""
        object = FieldTest()
        self.failUnless(object.ByteField == 0)

        object.ByteField = 1
        self.failUnless(object.ByteField == 1)
Пример #46
0
def test_string_field():
    """Test string fields."""
    ob = FieldTest()
    assert ob.StringField == "spam"

    ob.StringField = "eggs"
    assert ob.StringField == "eggs"
Пример #47
0
    def testInt32Field(self):
        """Test int32 fields."""
        object = FieldTest()
        self.failUnless(object.Int32Field == 0)

        object.Int32Field = 1
        self.failUnless(object.Int32Field == 1)
Пример #48
0
def test_byte_field():
    """Test byte fields."""
    ob = FieldTest()
    assert ob.ByteField == 0

    ob.ByteField = 1
    assert ob.ByteField == 1
Пример #49
0
    def testUInt64Field(self):
        """Test uint64 fields."""
        object = FieldTest()
        self.failUnless(object.UInt64Field == 0)

        object.UInt64Field = 1
        self.failUnless(object.UInt64Field == 1)
Пример #50
0
def test_uint32_field():
    """Test uint32 fields."""
    ob = FieldTest()
    assert ob.UInt32Field == 0

    ob.UInt32Field = 1
    assert ob.UInt32Field == 1
Пример #51
0
    def testSingleField(self):
        """Test single fields."""
        object = FieldTest()
        self.failUnless(object.SingleField == 0.0)

        object.SingleField = 1.1
        self.failUnless(object.SingleField == 1.1)
Пример #52
0
def test_single_field():
    """Test single fields."""
    ob = FieldTest()
    assert ob.SingleField == 0.0

    ob.SingleField = 1.1
    assert ob.SingleField == 1.1
Пример #53
0
    def testStringField(self):
        """Test string fields."""
        object = FieldTest()
        self.failUnless(object.StringField == "spam")

        object.StringField = "eggs"
        self.failUnless(object.StringField == "eggs")
Пример #54
0
def test_enum_field():
    """Test enum fields."""
    from Python.Test import ShortEnum

    ob = FieldTest()
    assert ob.EnumField == ShortEnum.Zero

    ob.EnumField = ShortEnum.One
    assert ob.EnumField == ShortEnum.One
Пример #55
0
def test_read_only_instance_field():
    """Test readonly instance fields."""
    assert FieldTest().ReadOnlyField == 0

    with pytest.raises(TypeError):
        FieldTest().ReadOnlyField = 1

    with pytest.raises(TypeError):
        del FieldTest().ReadOnlyField
Пример #56
0
def test_enum_field():
    """Test enum fields."""
    from Python.Test import ShortEnum

    ob = FieldTest()
    assert ob.EnumField == ShortEnum.Zero

    ob.EnumField = ShortEnum.One
    assert ob.EnumField == ShortEnum.One
Пример #57
0
def test_public_instance_field():
    """Test public instance fields."""
    ob = FieldTest()
    assert ob.PublicField == 0

    ob.PublicField = 1
    assert ob.PublicField == 1

    with pytest.raises(TypeError):
        del FieldTest().PublicField
Пример #58
0
def test_protected_instance_field():
    """Test protected instance fields."""
    ob = FieldTest()
    assert ob.ProtectedField == 0

    ob.ProtectedField = 1
    assert ob.ProtectedField == 1

    with pytest.raises(TypeError):
        del FieldTest().ProtectedField
Пример #59
0
def test_internal_field():
    """Test internal fields."""

    with pytest.raises(AttributeError):
        _ = FieldTest().InternalField

    with pytest.raises(AttributeError):
        _ = FieldTest().InternalStaticField

    with pytest.raises(AttributeError):
        _ = FieldTest.InternalStaticField
Пример #60
0
def test_private_field():
    """Test private fields."""

    with pytest.raises(AttributeError):
        _ = FieldTest().PrivateField

    with pytest.raises(AttributeError):
        _ = FieldTest().PrivateStaticField

    with pytest.raises(AttributeError):
        _ = FieldTest.PrivateStaticField