Re: Numeric array in unittest problem

2005-11-22 Thread [EMAIL PROTECTED]
Thanks all, I will use alltrue and allclose as Alex and Robert point out.. Cheers, pujo -- http://mail.python.org/mailman/listinfo/python-list

Numeric array in unittest problem

2005-11-21 Thread [EMAIL PROTECTED]
hello, I found that if I use Numeric.array into unittest it is not consistance, Is that normal ? import Numeric class myTest(unittest.TestCase): def runTest(self): a = Numeric.array([1,2]) b = Numeric.array([1,33]) self.assertEqual(a, b) pass This will not raise

Re: Numeric array in unittest problem

2005-11-21 Thread Peter Hansen
[EMAIL PROTECTED] wrote: hello, I found that if I use Numeric.array into unittest it is not consistance, Is that normal ? import Numeric class myTest(unittest.TestCase): def runTest(self): a = Numeric.array([1,2]) b = Numeric.array([1,33])

Re: Numeric array in unittest problem

2005-11-21 Thread [EMAIL PROTECTED]
Sorry Peter, Try this import unittest import Numeric class myTest(unittest.TestCase): def runTest(self): var1 = Numeric.array([1,22]) var2 = Numeric.array([1,33]) self.assertEqual(var1,var2) if __name__ == '__main__': unittest.main() pujo --

Re: Numeric array in unittest problem

2005-11-21 Thread Robert Kern
[EMAIL PROTECTED] wrote: hello, I found that if I use Numeric.array into unittest it is not consistance, Is that normal ? import Numeric class myTest(unittest.TestCase): def runTest(self): a = Numeric.array([1,2]) b = Numeric.array([1,33])

Re: Numeric array in unittest problem

2005-11-21 Thread Alex Martelli
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Sorry Peter, Try this import unittest import Numeric class myTest(unittest.TestCase): def runTest(self): var1 = Numeric.array([1,22]) var2 = Numeric.array([1,33]) self.assertEqual(var1,var2) if __name__

Re: Numeric array in unittest problem

2005-11-21 Thread Robert Kern
Alex Martelli wrote: import Numeric a=Numeric.array([1,22]) b=Numeric.array([1,33]) c = a==b c array([1, 0]) assert(c) i.e., thanks to element-by-element evaluation, == will generally return a true value for ANY comparison of Numeric arrays, causing a very frequent beginner's bug to be

Re: Numeric array in unittest problem

2005-11-21 Thread Roman Bertle
* Alex Martelli [EMAIL PROTECTED]: [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Sorry Peter, Try this import unittest import Numeric class myTest(unittest.TestCase): def runTest(self): var1 = Numeric.array([1,22]) var2 = Numeric.array([1,33])

Re: Numeric array in unittest problem

2005-11-21 Thread Peter Hansen
[EMAIL PROTECTED] wrote: Sorry Peter, Try this import unittest import Numeric class myTest(unittest.TestCase): def runTest(self): var1 = Numeric.array([1,22]) var2 = Numeric.array([1,33]) self.assertEqual(var1,var2) if __name__ == '__main__':