Thanks all,
I will use alltrue and allclose as Alex and Robert point out..
Cheers,
pujo
--
http://mail.python.org/mailman/listinfo/python-list
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
[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])
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
--
[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])
[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__
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
* 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])
[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__':