scidash / neuronunit

A package for data-driven validation of neuron and ion channel models using SciUnit
http://neuronunit.scidash.org
38 stars 24 forks source link

Problem with new latest sciunit dev. Cannot construct new tests suite object. #179

Closed russelljjarvis closed 6 years ago

russelljjarvis commented 6 years ago
~/neuronunit/neuronunit/optimization/get_neab.py in <module>()
     68 #update amplitude at the location in sciunit thats its passed to, without any loss of generality.
     69 import pdb; pdb.set_trace()
---> 70 suite = sciunit.TestSuite("vm_suite",tests)#,hooks=hooks)
     71 
     72 def impute_criteria(observations_donar,observations_acceptor):

/opt/conda/lib/python3.5/site-packages/sciunit/suites.py in __init__(self, tests, name, weights, include_models, skip_models, hooks)
     18                  skip_models=None, hooks=None):
     19         self.name = name if name else "Suite_%d" % random.randint(0,1e12)
---> 20         self.tests = self.check_tests(tests)
     21         self.weights_ = [] if not weights else list(weights)
     22         self.include_models = include_models if include_models else []

/opt/conda/lib/python3.5/site-packages/sciunit/suites.py in check_tests(self, tests)
     55                                          "containing a non-Test."))
     56             except TypeError:
---> 57                 raise TypeError(("Test suite was not provided with "
     58                                  "a test or iterable."))
     59         return tests

TypeError: Test suite was not provided with a test or iterable.

Using python debugger it was confirmed that tests is an iterable list of test objects.

(Pdb) type(tests)
<class 'list'>
(Pdb) for t in tests: print(type(t))
<class 'neuronunit.tests.fi.RheobaseTestP'>
<class 'neuronunit.tests.passive.InputResistanceTest'>
<class 'neuronunit.tests.passive.TimeConstantTest'>
<class 'neuronunit.tests.passive.CapacitanceTest'>
<class 'neuronunit.tests.passive.RestingPotentialTest'>
<class 'neuronunit.tests.waveform.InjectedCurrentAPWidthTest'>
<class 'neuronunit.tests.waveform.InjectedCurrentAPAmplitudeTest'>
<class 'neuronunit.tests.waveform.InjectedCurrentAPThresholdTest'>

As a practical work around it might be okay to just not cast tests to sciunit.TestSuite.

rgerkin commented 6 years ago

Check the signature for TestSuite: the name is now an optional argument that comes after the list of tests. This was changed a while back to match the format of all of the other constructors.