| 436 | class 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)) |