Skip to content

Commit

Permalink
Fix easy to fix python issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Dec 18, 2023
1 parent 2cf88ea commit 727ad6c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions python/podio_gen/generator_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def _to_json(self):
"""Return a string representation that can be parsed again"""
return self.full_type


class MemberVariable:
"""Simple class to hold information about a member variable"""
def __init__(self, name, **kwargs):
Expand Down
20 changes: 10 additions & 10 deletions python/podio_gen/test_ClassDefinitionValidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,16 +446,16 @@ def test_datatype_uses_interface_type(self):
self.validate, make_dm({}, datatype, self.valid_interface), False)

def test_interface_valid_upstream(self):
"""Make sure that we can use interface definitions from upstream models"""
# Create an upstream datamodel that contains the interface type
upstream_dm = make_dm({}, self.valid_datatype, self.valid_interface)

# Make a downstream model datatype that uses the interface from the upstream
# but doesn't bring along its own interface definitions
datatype = {'DownstreamType': deepcopy(self.valid_datatype['DataType'])}
datatype['DownstreamType']['OneToOneRelations'] = [MemberVariable(type='InterfaceType', name='interfaceRelation')]
self._assert_no_exception(DefinitionError, '{} should allow to use interface types from an upstream datamodel',
self.validate, make_dm({}, datatype), upstream_dm)
"""Make sure that we can use interface definitions from upstream models"""
# Create an upstream datamodel that contains the interface type
upstream_dm = make_dm({}, self.valid_datatype, self.valid_interface)

# Make a downstream model datatype that uses the interface from the upstream
# but doesn't bring along its own interface definitions
datatype = {'DownstreamType': deepcopy(self.valid_datatype['DataType'])}
datatype['DownstreamType']['OneToOneRelations'] = [MemberVariable(type='InterfaceType', name='interfaceRelation')]
self._assert_no_exception(DefinitionError, '{} should allow to use interface types from an upstream datamodel',
self.validate, make_dm({}, datatype), upstream_dm)


if __name__ == '__main__':
Expand Down

0 comments on commit 727ad6c

Please sign in to comment.