Open jpeyhardi opened 5 years ago
This kind of errors
Traceback (most recent call last):
File "/home/jean/Bureau/developpement/Core/build/test/test_distribution.py", line 34, in test_pdf_ldf_cdf
self.assertAlmostEqual(self._dist.cdf(v - 1) + self._dist.pdf(v), self._dist.cdf(v))
Boost.Python.ArgumentError: Python argument types in
DiscreteUnivariateDistribution.cdf(BetaBinomialDistribution, numpy.int64)
did not match C++ signature:
cdf(statiskit::DiscreteUnivariateDistribution {lvalue}, int)
is due to passing an integer that is in fact a numpy.int64
instance instead of being an Python int
instance.
This means than int the loop, you must add a line v=int(v)
Once these changes made, you need to update the Python source code to Python 3 syntax (error with basestring
and dictionary changed size during iteration
).
To do so, type the following commands (you must be located in the repository root):
2to3 -n -w src/py/statiskit -x next
2to3 -n -w test
Ok thanks, now I obtain
Test moments ... ok
Test probability distribution function and related functions ... ok
Test quantile computation ... ok
Test moments ... ok
Test probability distribution function and related functions ... ok
Test quantile computation ... ok
Test moments ... ok
Test probability distribution function and related functions ... ok
Test quantile computation ... ok
Test binomial ML estimation ... ok
Test binomial MM estimation ... ok
Test moments ... ok
Test probability distribution function and related functions ... ok
Test quantile computation ... ok
Test categorical ML estimation ... ok
Test Ordinal distribution get and set ordered pi and oredered values ... ok
Test categorical ML estimation ... ok
Test named data access ... ERROR
Test univariate data cdf plot ... ERROR
Test multivariate data copy ... ok
Test univariate and multivariate data dispersion ... ERROR
Test multivariate data extraction ... ERROR
Test univariate and multivariate data location ... ERROR
Test univariate and multivariate data pdf plot ... ERROR
Test univariate and multivariate data string representation ... ERROR
Test univariate and multivariate data HTML representation ... ERROR
Test write data to csv ... ERROR
Test moments ... ok
Test probability distribution function and related functions ... ok
Test quantile computation ... ok
Test geometric distribution ML estimation ... ok
Test moments ... ok
Test probability distribution function and related functions ... ok
Test quantile computation ... ok
Test logarithmic distribution ML estimation ... ok
Test moments ... ok
Test probability distribution function and related functions ... ok
Test quantile computation ... ok
Test moments ... ok
Test probability distribution function and related functions ... ok
Test quantile computation ... ok
Test mixture estimation using the EM algorithm ... ok
Test moments ... ok
Test probability distribution function and related functions ... ok
Test mixture posterior probabilities ... ok
Test quantile computation ... ok
Test multinormal distribution simulation ... ok
Test negative binomial ML estimation ... ok
Test negative binomial MM estimation ... ok
Test moments ... ok
Test probability distribution function and related functions ... ok
Test quantile computation ... ok
Test normal ML estimation ... ok
Test moments ... ok
Test probability distribution function and related functions ... ok
Test quantile computation ... ok
Test ordinal ML estimation ... ok
Test Poisson ML estimation ... ok
Test moments ... ok
Test probability distribution function and related functions ... ok
Test quantile computation ... ok
Test sample space encoding of events ... ERROR
Test AIC selection ... ok
Test AICc selection ... ok
Test BIC selection ... ok
Test HQIC selection ... ok
Test slope heuristic ... ERROR
Test Dirichlet multinomial splitting estimation ... ok
Test multinomial splitting estimation ... ok
======================================================================
ERROR: Test named data access
----------------------------------------------------------------------
Traceback (most recent call last):
[Build error - file "src/py/statiskit/core/data.py" at line 416, see build results]
File "/home/jean/.miniconda/envs/statiskit/lib/python3.6/site-packages/statiskit/core/data.py", line 416, in __getattr__
names = self.names
[Build error - file "src/py/statiskit/core/data.py" at line 403, see build results]
File "/home/jean/.miniconda/envs/statiskit/lib/python3.6/site-packages/statiskit/core/data.py", line 403, in names
return [str(component.name) for component in self.components]
TypeError: iter() returned non-iterator of type 'Iterator'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
[Build error - file "test/test_data.py" at line 33, see build results]
File "/home/jean/Bureau/developpement/Core/build/test/test_data.py", line 33, in test_access
for uevent, mevent in zip(self._data.pen.events, self._data.events):
[Build error - file "src/py/statiskit/core/data.py" at line 420, see build results]
File "/home/jean/.miniconda/envs/statiskit/lib/python3.6/site-packages/statiskit/core/data.py", line 420, in __getattr__
raise AttributeError("'" + self.__class__.__name__ + "' object has no attribute '" + attr + "'")
AttributeError: 'MultivariateDataFrame' object has no attribute 'pen'
======================================================================
ERROR: Test univariate data cdf plot
----------------------------------------------------------------------
Traceback (most recent call last):
[Build error - file "test/test_data.py" at line 80, see build results]
File "/home/jean/Bureau/developpement/Core/build/test/test_data.py", line 80, in test_cdf_plot
for component in self._data.components:
TypeError: iter() returned non-iterator of type 'Iterator'
======================================================================
ERROR: Test univariate and multivariate data dispersion
----------------------------------------------------------------------
Traceback (most recent call last):
[Build error - file "test/test_data.py" at line 66, see build results]
File "/home/jean/Bureau/developpement/Core/build/test/test_data.py", line 66, in test_dispersion
for index, component in enumerate(self._data.components):
TypeError: iter() returned non-iterator of type 'Iterator'
======================================================================
ERROR: Test multivariate data extraction
----------------------------------------------------------------------
Traceback (most recent call last):
[Build error - file "test/test_data.py" at line 75, see build results]
File "/home/jean/Bureau/developpement/Core/build/test/test_data.py", line 75, in test_extract
data = self._data.extract([0, 1])
[Build error - file "src/py/statiskit/core/data.py" at line 289, see build results]
File "/home/jean/.miniconda/envs/statiskit/lib/python3.6/site-packages/statiskit/core/data.py", line 289, in extract
args = [index if index >= 0 else index + len(self.components) for index in args]
[Build error - file "src/py/statiskit/core/data.py" at line 289, see build results]
File "/home/jean/.miniconda/envs/statiskit/lib/python3.6/site-packages/statiskit/core/data.py", line 289, in <listcomp>
args = [index if index >= 0 else index + len(self.components) for index in args]
TypeError: '>=' not supported between instances of 'list' and 'int'
======================================================================
ERROR: Test univariate and multivariate data location
----------------------------------------------------------------------
Traceback (most recent call last):
[Build error - file "test/test_data.py" at line 56, see build results]
File "/home/jean/Bureau/developpement/Core/build/test/test_data.py", line 56, in test_location
for index, component in enumerate(self._data.components):
TypeError: iter() returned non-iterator of type 'Iterator'
======================================================================
ERROR: Test univariate and multivariate data pdf plot
----------------------------------------------------------------------
Traceback (most recent call last):
[Build error - file "test/test_data.py" at line 50, see build results]
File "/home/jean/Bureau/developpement/Core/build/test/test_data.py", line 50, in test_pdf_plot
for component in self._data.components:
TypeError: iter() returned non-iterator of type 'Iterator'
======================================================================
ERROR: Test univariate and multivariate data string representation
----------------------------------------------------------------------
Traceback (most recent call last):
[Build error - file "test/test_data.py" at line 38, see build results]
File "/home/jean/Bureau/developpement/Core/build/test/test_data.py", line 38, in test_repr
for component in self._data.components:
TypeError: iter() returned non-iterator of type 'Iterator'
======================================================================
ERROR: Test univariate and multivariate data HTML representation
----------------------------------------------------------------------
Traceback (most recent call last):
[Build error - file "test/test_data.py" at line 44, see build results]
File "/home/jean/Bureau/developpement/Core/build/test/test_data.py", line 44, in test_repr_html
for component in self._data.components:
TypeError: iter() returned non-iterator of type 'Iterator'
======================================================================
ERROR: Test write data to csv
----------------------------------------------------------------------
Traceback (most recent call last):
[Build error - file "test/test_data.py" at line 87, see build results]
File "/home/jean/Bureau/developpement/Core/build/test/test_data.py", line 87, in test_write_csv
self._data.write_csv(tmp.name, header=True)
[Build error - file "src/py/statiskit/core/io.py" at line 46, see build results]
File "/home/jean/.miniconda/envs/statiskit/lib/python3.6/site-packages/statiskit/core/io.py", line 46, in write_csv
filehandler.write(sep.join(component.name for component in data.components)+'\n')
TypeError: iter() returned non-iterator of type 'Iterator'
======================================================================
ERROR: Test sample space encoding of events
----------------------------------------------------------------------
Traceback (most recent call last):
[Build error - file "test/test_sample_space.py" at line 27, see build results]
File "/home/jean/Bureau/developpement/Core/build/test/test_sample_space.py", line 27, in test_encode
for event in self._data.events:
TypeError: iter() returned non-iterator of type 'Iterator'
======================================================================
ERROR: Test slope heuristic
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jean/.miniconda/envs/statiskit/lib/python3.6/site-packages/statiskit/core/data.py", line 416, in __getattr__
names = self.names
File "/home/jean/.miniconda/envs/statiskit/lib/python3.6/site-packages/statiskit/core/data.py", line 403, in names
return [str(component.name) for component in self.components]
TypeError: iter() returned non-iterator of type 'Iterator'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
[Build error - file "test/test_slope_heuristic.py" at line 24, see build results]
File "/home/jean/Bureau/developpement/Core/build/test/test_slope_heuristic.py", line 24, in test_slope_heuristic
sh = core.SlopeHeuristic([pen.value for pen in self._data.pen.events], [-contrast.value for contrast in self._data.contrast.events])
File "/home/jean/.miniconda/envs/statiskit/lib/python3.6/site-packages/statiskit/core/data.py", line 420, in __getattr__
raise AttributeError("'" + self.__class__.__name__ + "' object has no attribute '" + attr + "'")
AttributeError: 'MultivariateDataFrame' object has no attribute 'pen'
Name Stmts Miss Cover
-------------------------------------------------------
statiskit/core/__init__.py 15 0 100%
statiskit/core/_core.py 329 0 100%
statiskit/core/_tools.py 8 4 50%
statiskit/core/base.py 13 0 100%
statiskit/core/controls.py 55 8 85%
statiskit/core/data.py 379 214 44%
statiskit/core/distribution.py 774 402 48%
statiskit/core/estimation.py 434 215 50%
statiskit/core/event.py 200 88 56%
statiskit/core/indicator.py 126 38 70%
statiskit/core/io.py 119 51 57%
statiskit/core/optionals.py 19 5 74%
statiskit/core/sample_space.py 151 44 71%
statiskit/core/singular.py 53 22 58%
statiskit/core/slope_heuristic.py 139 73 47%
-------------------------------------------------------
TOTAL 2814 1164 59%
----------------------------------------------------------------------
Ran 69 tests in 0.226s
FAILED (errors=11)
scons: *** [build/test/.coverage] Error 1
scons: building terminated because of errors.
[Finished in 19.4s with exit code 2]
[cmd: bash -c 'source /home/jean/.miniconda/bin/activate statiskit && scons test --diagnostics-color=never --with-nose-debug=none']
[dir: /home/jean/Bureau/developpement/Core]
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin]
Commit & push, please.
Ok, the commit is jpeyhardi/Core@d2ba4a364bb7e14ba1c57215b811d1371bdb16f5
This kind of errors
TypeError: iter() returned non-iterator of type 'Iterator'
is due to a missing __next__
method in a class that should represent an iterator in Python 3.
The method was named next
in Python 2.
For instance, in the https://github.com/jpeyhardi/Core/blob/d2ba4a364bb7e14ba1c57215b811d1371bdb16f5/src/py/statiskit/core/data.py file on line 371, there is a method named next
that should be renamed __next__
.
I have some tests errors
The commit is jpeyhardi/Core@3e19064f9e19654fbb57168364316be0c1cb9a3d and the environment used for the build is described by environment.txt
Using the Sublime Text build system (
Ctrl + Shift + B
then choosingStatisKit
), I have the following error message: