def test_skipauto(): plug = df.XDressPlugin() plugins = DEFAULT_PLUGINS + plug.requires + ('xdress.descfilter', ) rc = RunControl(rc=DEFAULT_RC_FILE, plugins=plugins) rc._update(plug.defaultrc) rc.skipauto = True rc.ts = TypeSystem() rc.env = {'plane.cpp': {'Plane': plane_class}} plug.setup(rc) plug.execute(rc) plug.teardown(rc) exp_plane = { 'name': 'Plane', 'namespace': 'util', 'parents': [], 'attrs': { 'homeAirport': 'str', 'maxrpm': 'float64', 'manufacturer': 'str', 'maxspeed': 'float32', 'position': ('vector', 'float64') }, 'methods': { ('Plane', ): None, ('Plane', ('homeAirport', 'str')): None, ('~Plane', ): None, ('land', ('coord', (('vector', 'int32', 'const'), '&'))): { 'return': 'str' }, ('isOnFire', ): { 'return': 'bool' } } } plane = rc.env['plane.cpp']['Plane'] print('********\nplane class stuff (actual then expected):\n') pprint.pprint(plane) pprint.pprint(exp_plane) assert_equal(plane, exp_plane)
def test_skipauto(): plug = df.XDressPlugin() plugins = DEFAULT_PLUGINS + plug.requires + ("xdress.descfilter",) rc = RunControl(rc=DEFAULT_RC_FILE, plugins=plugins) rc._update(plug.defaultrc) rc.skipauto = True rc.ts = TypeSystem() rc.env = {"plane.cpp": {"Plane": plane_class}} plug.setup(rc) plug.execute(rc) plug.teardown(rc) exp_plane = { "name": "Plane", "namespace": "util", "parents": [], "attrs": { "homeAirport": "str", "maxrpm": "float64", "manufacturer": "str", "maxspeed": "float32", "position": ("vector", "float64"), }, "methods": { ("Plane",): None, ("Plane", ("homeAirport", "str")): None, ("~Plane",): None, ("land", ("coord", (("vector", "int32", "const"), "&"))): {"return": "str"}, ("isOnFire",): {"return": "bool"}, }, } plane = rc.env["plane.cpp"]["Plane"] print("********\nplane class stuff (actual then expected):\n") pprint.pprint(plane) pprint.pprint(exp_plane) assert_equal(plane, exp_plane)
def test_skipauto(): plug = df.XDressPlugin() plugins = DEFAULT_PLUGINS + plug.requires + ('xdress.descfilter',) rc = RunControl(rc=DEFAULT_RC_FILE, plugins=plugins) rc._update(plug.defaultrc) rc.skipauto = True rc.ts = TypeSystem() rc.env = {'plane.cpp': {'Plane': plane_class}} plug.setup(rc) plug.execute(rc) plug.teardown(rc) exp_plane = { 'name': 'Plane', 'namespace': 'util', 'parents': [], 'attrs': { 'homeAirport': 'str', 'maxrpm': 'float64', 'manufacturer': 'str', 'maxspeed': 'float32', 'position': ('vector', 'float64')}, 'methods': { ('Plane',): None, ('Plane', ('homeAirport', 'str')): None, ('~Plane',): None, ('land', ('coord', (('vector', 'int32', 'const'), '&'))): { 'return': 'str'}, ('isOnFire',): { 'return': 'bool'}} } plane = rc.env['plane.cpp']['Plane'] print('********\nplane class stuff (actual then expected):\n') pprint.pprint(plane) pprint.pprint(exp_plane) assert_equal(plane, exp_plane)
def test_rc_update(): rc = RunControl(a=NotSpecified, b="hello") rc._update(RunControl(c=1, b="world")) assert_equal(rc, {'a': NotSpecified, 'b': 'world', 'c': 1}) rc._update({'a': 42, 'c': NotSpecified}) assert_equal(rc, {'a': 42, 'b': 'world', 'c': 1})
def test_rc_update(): rc = RunControl(a=NotSpecified, b="hello") rc._update(RunControl(c=1, b="world")) assert_equal(rc, {"a": NotSpecified, "b": "world", "c": 1}) rc._update({"a": 42, "c": NotSpecified}) assert_equal(rc, {"a": 42, "b": "world", "c": 1})