| 778 | |
| 779 | @unittest.skipUnless(HAVE_NUMPY, "requires build with numpy-support") |
| 780 | def test_numpy_conversion_1(self): |
| 781 | a = histogram(integer(0, 3)) |
| 782 | for i in range(10): |
| 783 | a(1, weight=3) |
| 784 | c = numpy.array(a) # a copy |
| 785 | v = numpy.asarray(a) # a view |
| 786 | self.assertEqual(c.dtype, numpy.float64) |
| 787 | self.assertTrue(numpy.all(c == numpy.array(((0, 30, 0, 0, 0), (0, 90, 0, 0, 0))))) |
| 788 | self.assertTrue(numpy.all(v == c)) |
| 789 | |
| 790 | @unittest.skipUnless(HAVE_NUMPY, "requires build with numpy-support") |
| 791 | def test_numpy_conversion_2(self): |