mirror of
https://github.com/JoelBender/bacpypes
synced 2025-09-28 22:15:23 +08:00
update tests to show that arrays or atomic types get 'natural' default values when the array is extended
This commit is contained in:
parent
87514b05c8
commit
d71d76c6de
|
@ -116,7 +116,7 @@ class TestIntegerArray(unittest.TestCase):
|
|||
|
||||
# make it longer
|
||||
ary[0] = 4
|
||||
assert ary.value[1:] == [1, 2, None, None]
|
||||
assert ary.value[1:] == [1, 2, 0, 0]
|
||||
|
||||
def test_get_item(self):
|
||||
if _debug: TestIntegerArray._debug("test_get_item")
|
||||
|
|
|
@ -159,7 +159,7 @@ class TestWritableArray(unittest.TestCase):
|
|||
assert obj.ReadProperty('location', 0) == 2
|
||||
|
||||
# array extended with none, should get property default value
|
||||
assert obj.ReadProperty('location', 2) == None
|
||||
assert obj.ReadProperty('location', 2) == ""
|
||||
|
||||
# wrong datatype
|
||||
with self.assertRaises(InvalidParameterDatatype):
|
||||
|
@ -184,11 +184,11 @@ class TestWritableArray(unittest.TestCase):
|
|||
if _debug: TestWritableArray._debug("test_replacing_array")
|
||||
|
||||
# create an object with a location
|
||||
obj = SampleWritableArray(location=ArrayOfCharacterString())
|
||||
obj = SampleWritableArray()
|
||||
if _debug: TestWritableArray._debug(" - obj.location: %r", obj.location)
|
||||
|
||||
# replace the array
|
||||
obj.WriteProperty('location', ["home", "work"])
|
||||
obj.WriteProperty('location', ArrayOfCharacterString(["home", "work"]))
|
||||
assert obj.ReadProperty('location', 0) == 2
|
||||
assert obj.ReadProperty('location', 1) == "home"
|
||||
assert obj.ReadProperty('location', 2) == "work"
|
||||
|
|
Loading…
Reference in New Issue
Block a user