Comments (32)
-
Testing of dev-python/oct2py-0.3.2 with CPython 2.7...
PYTHONPATH=build-2.7/lib nosetests --verbosity=1
..........F..F..F.F..F...F.FF.F.....F.FAIL: Test python dictionary
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 335, in test_dict
self.helper(test[key], incoming[key])
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 326, in helper
self.assertEqual(incoming, expected_type)
AssertionError: 'spam' != <type 'unicode'>
FAIL: Test nested python dictionary
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 348, in test_nested_dict
self.helper(test[key], incoming[key])
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 326, in helper
self.assertEqual(incoming, expected_type)
AssertionError: 'spam' != <type 'unicode'>
FAIL: Test python numeric types
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 381, in test_numeric
self.helper(int(test))
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 326, in helper
self.assertEqual(incoming, expected_type)
AssertionError: 120 != <type 'numpy.int32'>
FAIL: Test python str and unicode types
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 391, in test_string
self.helper(test)
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 326, in helper
self.assertEqual(incoming, expected_type)
AssertionError: 'spam' != <type 'unicode'>
FAIL: Test incoming float types
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 148, in test_floats
self.helper(self.data.num, keys, types)
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 132, in helper
self.assertEqual(type(base[key]), type_)
AssertionError: <type 'numpy.float32'> != <type 'numpy.float64'>
FAIL: Test incoming string types
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 171, in test_string
self.helper(self.data.string, keys, types)
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 132, in helper
self.assertEqual(type(base[key]), type_)
AssertionError: <type 'str'> != <type 'unicode'>
FAIL: Send an ndarray and make sure we get the same array back
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 471, in test_ndarrays
self.assertRaises(Oct2PyError, octave.roundtrip, outgoing)
AssertionError: Oct2PyError not raised
FAIL: Send a scalar numpy type and make sure we get the same number back.
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 441, in test_scalars
self.assertRaises(Oct2PyError, octave.roundtrip, outgoing)
AssertionError: Oct2PyError not raised
FAIL: Test roundtrip value and type preservation for float types
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 255, in test_float
self.helper(self.data.num['float32'], np.float64)
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 241, in helper
self.assertEqual(type(incoming), expected_type)
AssertionError: <type 'numpy.float32'> != <type 'numpy.float64'>
FAIL: Test roundtrip python type conversions
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 84, in test_python_conversions
self.assertEqual(octave_type, oct_type)
AssertionError: 'int64' != 'int32'
Ran 38 tests in 13.129s
FAILED (failures=10)
and python 3 is different again.
-
Testing of dev-python/oct2py-0.3.2 with CPython 3.2...
PYTHONPATH=build-3.2/lib nosetests --verbosity=1
................F....F.....FF.EE.EE.F.ERROR: Test roundtrip value and type preservation for float types
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 254, in test_float
self.helper(self.data.num[key])
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 233, in helper
self.nested_equal(incoming, outgoing)
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 212, in nested_equal
elif isinstance(val1, basestring):
NameError: global name 'basestring' is not defined
ERROR: Test roundtrip value and type preservation for integer types
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 248, in test_int
self.helper(self.data.num.int[key])
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 233, in helper
self.nested_equal(incoming, outgoing)
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 212, in nested_equal
elif isinstance(val1, basestring):
NameError: global name 'basestring' is not defined
ERROR: Test roundtrip value and type preservation for misc numeric types
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 262, in test_misc_num
self.helper(self.data.num[key])
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 233, in helper
self.nested_equal(incoming, outgoing)
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 212, in nested_equal
elif isinstance(val1, basestring):
NameError: global name 'basestring' is not defined
ERROR: Test roundtrip value and type preservation for string types
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 273, in test_string
self.helper(self.data.string[key])
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 233, in helper
self.nested_equal(incoming, outgoing)
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 212, in nested_equal
elif isinstance(val1, basestring):
NameError: global name 'basestring' is not defined
FAIL: Test python numeric types
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 324, in helper
self.assertEqual(type(incoming), expected_type)
File "/usr/lib64/python3.2/unittest/case.py", line 628, in assertEqual
assertion_func(first, second, msg=msg)
AssertionError: <class 'numpy.int64'> != <class 'numpy.int32'>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 381, in test_numeric
self.helper(int(test))
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 326, in helper
self.assertEqual(incoming, expected_type)
AssertionError: 656 != <class 'numpy.int32'>
FAIL: Test incoming float types
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 148, in test_floats
self.helper(self.data.num, keys, types)
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 132, in helper
self.assertEqual(type(base[key]), type_)
AssertionError: <class 'numpy.float32'> != <class 'numpy.float64'>
FAIL: Send an ndarray and make sure we get the same array back
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 471, in test_ndarrays
self.assertRaises(Oct2PyError, octave.roundtrip, outgoing)
AssertionError: Oct2PyError not raised by roundtrip
FAIL: Send a scalar numpy type and make sure we get the same number back.
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 441, in test_scalars
self.assertRaises(Oct2PyError, octave.roundtrip, outgoing)
AssertionError: Oct2PyError not raised by roundtrip
FAIL: Test roundtrip python type conversions
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.2/work/oct2py-0.3.2/oct2py/tests/test_oct2py.py", line 84, in test_python_conversions
self.assertEqual(octave_type, oct_type)
AssertionError: 'int64' != 'int32'
- int64
- int32
Ran 38 tests in 14.032s
FAILED (errors=4, failures=5)
from oct2py.
I believe I have addressed these issues since. Can you try 0.3.4 and see what your results are?
from oct2py.
archtester oct2py # emerge =dev-python/oct2py-0.3.4
Source compiled.
Testing of dev-python/oct2py-0.3.4 with CPython 2.7...
PYTHONPATH=build-2.7/lib nosetests --verbosity=1
..............................FF........F.FAIL: Send an ndarray and make sure we get the same array back
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.4/work/oct2py-0.3.4/oct2py/tests/test_oct2py.py", line 446, in test_ndarrays
self.assertRaises(Oct2PyError, octave.roundtrip, outgoing)
AssertionError: Oct2PyError not raised
FAIL: Send a scalar numpy type and make sure we get the same number back.
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.4/work/oct2py-0.3.4/oct2py/tests/test_oct2py.py", line 416, in test_scalars
self.assertRaises(Oct2PyError, octave.roundtrip, outgoing)
AssertionError: Oct2PyError not raised
FAIL: Test roundtrip python type conversions
Traceback (most recent call last):
File "/mnt/gen2/TmpDir/portage/dev-python/oct2py-0.3.4/work/oct2py-0.3.4/oct2py/tests/test_oct2py.py", line 77, in test_python_conversions
self.assertEqual(octave_type, oct_type)
AssertionError: u'int64' != 'int32'
Ran 42 tests in 5.199s
FAILED (failures=3)
from oct2py.
I cannot reproduce these errors in 0.3.4 or 0.3.5 using the PyPi files in Python 2.7. I'm not sure what archtester could be doing differently from nosetests or running test_oct2py.py directly. What versions of numpy and scipy are you using?
from oct2py.
oct2py version 0.3.4
numpy version 1.6.2
scipy version 0.11.0
ebuild oct2py-0.3.4.ebuild clean test
-
Testing of dev-python/oct2py-0.3.4 with CPython 2.7...
PYTHONPATH=build-2.7/lib nosetests --verbosity=1
..............................FF........F.self.assertRaises(Oct2PyError, octave.roundtrip, outgoing)
AssertionError: Oct2PyError not raisedself.assertRaises(Oct2PyError, octave.roundtrip, outgoing)
AssertionError: Oct2PyError not raisedself.assertEqual(octave_type, oct_type)
AssertionError: u'int64' != 'int32'
Ran 42 tests in 4.721s
FAILED (failures=3)
from oct2py.
This is my output from 3.6 installed with pip:
C:\Python27\Lib\site-packages\oct2py\tests>test_oct2py.py
oct2py test
********************
.............................FF.........
======================================================================
FAIL: Send an ndarray and make sure we get the same array back
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\oct2py\tests\test_oct2py.py", line 446, in test_ndarrays
self.assertRaises(Oct2PyError, octave.roundtrip, outgoing)
AssertionError: Oct2PyError not raised
======================================================================
FAIL: Send a scalar numpy type and make sure we get the same number back.
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\oct2py\tests\test_oct2py.py", line 416, in test_scalars
self.assertRaises(Oct2PyError, octave.roundtrip, outgoing)
AssertionError: Oct2PyError not raised
----------------------------------------------------------------------
Ran 40 tests in 8.172s
FAILED (failures=2)
numpy 1.6.2
scipy 0.11.0
(with MKL)
from oct2py.
Is your OS 64 bit? Also, what version of octave do you have?
from oct2py.
Is 32 bit - XP SP3.
I used this octave: octave-3.6.2-vs2010-setup.exe
from oct2py.
How about your setup, @idella?
from oct2py.
sci-mathematics/octave
Installed versions: 3.6.3
archtester testuser # uname -a
Linux archtester 3.4.11-tuxonice #2 SMP Fri Oct 26 09:01:22 WST 2012 x86_64 AMD Athlon(tm) II X4 645 Processor AuthenticAMD GNU/Linux
from oct2py.
I was not able to reproduce the errors on Windows 7, but my OS and my Octave were 64 bit. However, on Linux Mint 14 64 bit, I can reproduce the same errors as @idella. Wow, it took me 4 months to think of 32 vs. 64 bit, sorry @idella. I will get to hacking on a solution.
from oct2py.
@idella, @klonuo, I believe I have addressed all of your concerns. If you do not mind, please install and test the latest source and make sure it passes on your machine. I will push a new version of oct2py this weekend. Thanks again.
from oct2py.
@blink1073, unfortunately I get exact same errors with current git version
I double checked numpy and scipy tests, but they pass fine, just some ufunc warnings and the like
from oct2py.
archtester oct2py # ebuild oct2py-0.3.6.ebuild clean test
Forcing test.
Downloading 'ftp://ftp.swin.edu.au/gentoo/distfiles/oct2py-0.3.6.tar.gz'
--2013-01-05 07:39:54-- ftp://ftp.swin.edu.au/gentoo/distfiles/oct2py-0.3.6.tar.gz
=> ‘/mnt/gentoo/distfiles/oct2py-0.3.6.tar.gz’
this it appears confirms acquiring the recent changes, correct me if wrong
- Testing of dev-python/oct2py-0.3.6 with CPython 2.7...
PYTHONPATH=build-2.7/lib nosetests --verbosity=1
..............................FF........F.
the rest a repeat of the above, sadl, do klonuo
from oct2py.
@idella, @klonuo, can you verify that in the directory found this way:
>>> import oct2py
>>> oct2py.__file__
In the file _matwrite.py
, there is the line:
if data.dtype.name in ['float128', 'complex256']:
from oct2py.
Otherwise, you can do the following:
pip install https://github.com/blink1073/oct2py/archive/master.zip
from oct2py.
@idella, @klonuo, can you verify that in the directory found this way: ...
In [9]: import oct2py
...: oct2py.__file__
...:
Out[9]: 'C:\\Python27\\lib\\site-packages\\oct2py\\__init__.pyc'
In [10]: cd 'C:\\Python27\\lib\\site-packages\\oct2py'
C:\Python27\lib\site-packages\oct2py
In [11]: !type _matwrite.py | findstr float
Currently the following types supported: float96, complex192, void
if data.dtype.name in ['float128', 'complex256']:
from oct2py.
@klonuo, lets figure out which typecode causes the error, can you please make the following patch and give the output?
diff --git a/oct2py/tests/test_oct2py.py b/oct2py/tests/test_oct2py.py
index 9e89291..339bf79 100644
--- a/oct2py/tests/test_oct2py.py
+++ b/oct2py/tests/test_oct2py.py
@@ -426,6 +426,7 @@ class NumpyTest(TestCase):
except TypeError:
continue
if typecode in self.blacklist:
+ print >> sys.stderr, '*{0}*'.format(typecode)
self.assertRaises(Oct2PyError, octave.roundtrip, outgoing)
continue
incoming = octave.roundtrip(outgoing)
from oct2py.
It's a *g*
It's also *G*
. If I change blacklist='V'
only then all tests are passed
from oct2py.
And the following?
diff --git a/oct2py/tests/test_oct2py.py b/oct2py/tests/test_oct2py.py
index 9e89291..a37e8ab 100644
--- a/oct2py/tests/test_oct2py.py
+++ b/oct2py/tests/test_oct2py.py
@@ -426,6 +426,7 @@ class NumpyTest(TestCase):
except TypeError:
continue
if typecode in self.blacklist:
+ print >> sys.stderr, '*{0}*'.format(outgoing.dtype.name)
self.assertRaises(Oct2PyError, octave.roundtrip, outgoing)
continue
incoming = octave.roundtrip(outgoing)
from oct2py.
It's *float64*
for g
and *complex128*
for G
from oct2py.
@klonuo, right, but those two datatypes types fail on some configurations (including mine), so I do not support them.
from oct2py.
@klonuo , what does the following show for you?
import numpy
test = numpy.ones(1)
test = test.astype('g')
print test.dtype.str, test.dtype.name
from oct2py.
those two datatypes types fail on some configurations (including mine)
So, why don't you see the same test errors?
what does the following show for you?
<f8 float64
from oct2py.
@klonuo, on my machine, it is properly typecast as a float128 and an Oct2PyError is raised, as expected. I'm not sure why it is not cast on your machine. Can you try the following patch?
diff --git a/oct2py/tests/test_oct2py.py b/oct2py/tests/test_oct2py.py
index 9e89291..bd48f95 100644
--- a/oct2py/tests/test_oct2py.py
+++ b/oct2py/tests/test_oct2py.py
@@ -413,7 +413,8 @@ class NumpyTest(TestCase):
"""Check value and type preservation of Numpy arrays
"""
codes = np.typecodes['All']
- blacklist = 'gGV'
+ blacklist_codes = 'V'
+ blacklist_names = ['float128', 'complex256']
def test_scalars(self):
"""Send a scalar numpy type and make sure we get the same number back.
@@ -425,7 +426,8 @@ class NumpyTest(TestCase):
outgoing = outgoing.astype(typecode)
except TypeError:
continue
- if typecode in self.blacklist:
+ if (typecode in self.blacklist_codes or
+ outgoing.dtype.name in self.blacklist_names):
self.assertRaises(Oct2PyError, octave.roundtrip, outgoing)
continue
incoming = octave.roundtrip(outgoing)
@@ -455,7 +457,8 @@ class NumpyTest(TestCase):
outgoing = outgoing.astype(typecode)
except TypeError:
continue
- if typecode in self.blacklist:
+ if (typecode in self.blacklist_codes or
+ outgoing.dtype.name in self.blacklist_names):
self.assertRaises(Oct2PyError, octave.roundtrip, outgoing)
continue
incoming = octave.roundtrip(outgoing)
from oct2py.
oct2py test
********************
.........................................
----------------------------------------------------------------------
Ran 41 tests in 7.422s
OK
from oct2py.
Woohoo!, thanks for your help, @klonuo.
from oct2py.
Thank you :)
from oct2py.
on ya blink
from oct2py.
@idella, I don't follow you, do your tests pass with 0.4.0?
from oct2py.
blink1073, yep, that's a parochial expression, it translates to good job, blink. yep, they pass, it's good.
from oct2py.
Great, thanks again for your patience and detailed bug reports. Cheers.
from oct2py.
Related Issues (20)
- error: 'upfirdn' undefined near line 121, column 121 HOT 5
- Struct fieldnames that start with number are ignored HOT 1
- Bug: PULL-PUSH-PULL 1D Column vector will convert into 1D Row Vector HOT 4
- push will push Cell HOT 2
- [Question] Properly end session HOT 4
- Using `system ("cat ~/.octaverc")` on Winows HOT 2
- initialization: graphics_toolkit: 2004h toolkit is not available HOT 5
- Run doesn't create new variables in the octave environment HOT 3
- Conflict with opencv HOT 5
- bracketed paste \x1b[?2004h issue HOT 3
- Memory Leak HOT 1
- Problem with calling function; too many outputs HOT 1
- When I use python multiprocessing to open multiple octave displays a timeou HOT 1
- Problem with matlab package folders?
- Thread pool executor leaves ghost-threads that fill up memory
- Calling function script takes 1.5 seconds HOT 1
- error: 'graphics_toolkit' undefined
- Error trying to import octave in Anaconda Spyder using "from oct2py import octave" HOT 7
- _exist function not removing special characters from response HOT 2
- Error on testing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oct2py.