Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
coretl committed Feb 10, 2017
1 parent b56fb41 commit e54b2b9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion malcolm/comms/pva/pvautil.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def pva_structure_from_value(self, value, empty_allowed=False):
elif isinstance(value, list):
# if not empty then determine its type
structure = list(set(
self.pva_structure_from_value(v) for v in value if value))
self.pva_structure_from_value(v) for v in value))
if len(structure) == 0 or len(structure) > 1 or \
isinstance(structure[0], pvaccess.PvObject):
# variant union
Expand Down
6 changes: 5 additions & 1 deletion tests/test_comms/test_pva/test_pvaservercomms.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,11 @@ def test_dict_to_stucture(self):
self.assertEquals(val, test_val)

# Test the variant union array type
val = self.PVA.pva_structure_from_value(OrderedDict({"union_array": [OrderedDict({"val1": 1}), OrderedDict({"val2": "2"})]}))
val = self.PVA.pva_structure_from_value(
{"union_array": [
{"val1": 1},
{"val2": "2"}
]})
test_dict = OrderedDict()
test_dict["union_array"] = [()]
test_val = pvaccess.PvObject(test_dict, "")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_core/test_stringarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_non_strings_raise(self):
with self.assertRaises(ValueError) as cm:
StringArray(1, 2, 3)
self.assertEqual(
cm.exception.message,
str(cm.exception),
'Expected StringArray(s1, s2, ...) or StringArray(seq). '
'Got StringArray(1, 2, 3)')

Expand Down

0 comments on commit e54b2b9

Please sign in to comment.