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

Method test_init

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

Source from the content-addressed store, hash-verified

436class test_histogram(unittest.TestCase):
437
438 def test_init(self):
439 histogram()
440 histogram(integer(-1, 1))
441 with self.assertRaises(TypeError):
442 histogram(1)
443 with self.assertRaises(TypeError):
444 histogram("bla")
445 with self.assertRaises(TypeError):
446 histogram([])
447 with self.assertRaises(TypeError):
448 histogram(regular)
449 with self.assertRaises(TypeError):
450 histogram(regular())
451 with self.assertRaises(TypeError):
452 histogram([integer(-1, 1)])
453 with self.assertRaises(ValueError):
454 histogram(integer(-1, 1), unknown_keyword="nh")
455
456 h = histogram(integer(-1, 2))
457 self.assertEqual(h.dim, 1)
458 self.assertEqual(h.axis(0), integer(-1, 2))
459 self.assertEqual(h.axis(0).shape, 5)
460 self.assertEqual(histogram(integer(-1, 2, uoflow=False)).axis(0).shape, 3)
461 self.assertNotEqual(h, histogram(regular(1, -1, 1)))
462 self.assertNotEqual(h, histogram(integer(-1, 1, label="ia")))
463
464 def test_copy(self):
465 a = histogram(integer(-1, 1))

Callers

nothing calls this directly

Calls 4

integerClass · 0.90
regularClass · 0.90
axisMethod · 0.80
histogramClass · 0.50

Tested by

no test coverage detected