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)
from __future__ import print_function import os from xdress.typesystem import TypeSystem from xdress import cythongen as cg from xdress import autodescribe as ad from xdress.astparsers import PARSERS_AVAILABLE from xdress.utils import parse_global_rc, Arg from tools import unit, assert_equal_or_diff, skip_then_continue, cleanfs from numpy.testing import dec ts = TypeSystem() if not os.path.isdir('build'): os.mkdir('build') base = ('Base', 'int32', 7, 0) def exp_base_desc(parser): # TODO: The results depend on the parser since gccxml misses stuff bad = parser == 'gccxml' return { 'name': base, 'namespace': 'xdress', 'parents': [], 'construct': 'struct', 'attrs': {} if bad else { 'field': 'int32'
'calc_params': calc_params_ds, 'calc': calc_ds, }, }, 'attrs': { 'sepeff': 'sepeff_t', }, 'methods': { ('Reprocess', ('sepeff', 'sepeff_t'), ('name', 'str', '""')): None, }, } mod = { 'Reprocess': desc, 'func': { 'docstring': "I am a weird function." }, 'docstring': "Python wrapper for Reprocess.", } from xdress.typesystem import TypeSystem ts = TypeSystem.empty() ts.register_refinement( 'sepeff_t', ('map', 'int32', 'float64'), cython_cyimport='xdtest.typeconverters', cython_pyimport='xdtest.typeconverters', cython_py2c='xdtest.typeconverters.sepeff_py2c({var})', )
('Reprocess', 'reprocess'), ('decay_nuc', 'storage'), ('from_nuc_struct', 'storage', None), ('Storage', 'storage'), ('FluencePoint', 'fluence_point'), ('ReactorParameters', 'reactor_parameters'), ('Reactor1G', 'reactor1g'), ('LightWaterReactor1G', 'light_water_reactor1g'), ('FastReactor1G', 'fast_reactor1g'), ('FuelFabrication', 'fuel_fabrication'), ('ReactorMG', 'reactormg'), ] functions = [] ts = TypeSystem.empty() # hack in some material registrations ts.register_class('Material', cython_c_type='cpp_material.Material', cython_cimport=('pyne', 'cpp_material'), cython_cy_type='material._Material', cython_py_type='material.Material', cython_template_class_name='Material', cython_cyimport=('pyne', 'material'), cython_pyimport=('pyne', 'material'), cython_c2py=('{pytype}({var})', ('{proxy_name} = {pytype}()\n' '{proxy_name}.mat_pointer[0] = {var}'), ('if {cache_name} is None:\n' ' {proxy_name} = {pytype}(free_mat=False)\n' ' {proxy_name}.mat_pointer = &{var}\n' ' {cache_name} = {proxy_name}\n')), cython_py2c=(
def test_io(): filename = 'hoover' hoover = TypeSystem().empty() hoover.extra_types = "excellent" hoover.dump(filename, format='pkl.gz') hoover = TypeSystem.load(filename, format='pkl.gz')