Commit d7986d11 authored by Theo Steininger's avatar Theo Steininger

Removed pretty_str from test_common.py.

parent 45c8584b
...@@ -16,47 +16,15 @@ ...@@ -16,47 +16,15 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik # NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes. # and financially supported by the Studienstiftung des deutschen Volkes.
import d2o
import numpy as np
from nose_parameterized import parameterized from nose_parameterized import parameterized
from nifty import RGSpace, LMSpace, HPSpace, GLSpace, PowerSpace from nifty import RGSpace, LMSpace, HPSpace, GLSpace, PowerSpace
from nifty.config import dependency_injector as di from nifty.config import dependency_injector as di
from string import strip
def pretty_str(obj):
if type(obj) == list:
return " ".join(pretty_str(x) for x in obj)
if type(obj) == tuple:
return " ".join(pretty_str(x) for x in obj)
if type(obj) == RGSpace:
return type(obj).__name__
elif type(obj) == LMSpace:
return type(obj).__name__
elif type(obj) == HPSpace:
return type(obj).__name__
elif type(obj) == GLSpace:
return type(obj).__name__
elif type(obj) == PowerSpace:
return type(obj).__name__
elif isinstance(obj, d2o.distributed_data_object):
return 'd2o'
elif type(obj) == dict:
if 'error' in obj:
return 'error_' + obj['error'].__name__
else:
return ''
elif type(obj) == np.ndarray:
return 'DATA'
else:
return str(obj)
def custom_name_func(testcase_func, param_num, param): def custom_name_func(testcase_func, param_num, param):
return "%s_%s" % ( return "%s_%s" % (
testcase_func.__name__, testcase_func.__name__,
strip(parameterized.to_safe_name( parameterized.to_safe_name("_".join(str(x) for x in param.args)),
" ".join(pretty_str(x) for x in param.args)), '_')
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment