MCPcopy Create free account
hub / github.com/boostorg/histogram / test_numpy_conversion_5

Method test_numpy_conversion_5

test/python_suite_test.py:857–880  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

855
856 @unittest.skipUnless(HAVE_NUMPY, "requires build with numpy-support")
857 def test_numpy_conversion_5(self):
858 a = histogram(integer(0, 3, uoflow=False),
859 integer(0, 2, uoflow=False))
860 a(0, 0)
861 for i in range(80):
862 a = a + a
863 # a now holds a multiprecision type
864 a(1, 0)
865 for i in range(2):
866 a(2, 0)
867 for i in range(3):
868 a(0, 1)
869 for i in range(4):
870 a(1, 1)
871 for i in range(5):
872 a(2, 1)
873 a1 = numpy.asarray(a)
874 self.assertEqual(a1.shape, (3, 2))
875 self.assertEqual(a1[0, 0], float(2 ** 80))
876 self.assertEqual(a1[1, 0], 1)
877 self.assertEqual(a1[2, 0], 2)
878 self.assertEqual(a1[0, 1], 3)
879 self.assertEqual(a1[1, 1], 4)
880 self.assertEqual(a1[2, 1], 5)
881
882 @unittest.skipUnless(HAVE_NUMPY, "requires build with numpy-support")
883 def test_numpy_conversion_6(self):

Callers

nothing calls this directly

Calls 2

integerClass · 0.90
histogramClass · 0.50

Tested by

no test coverage detected