def test_in_bin(self): assert np.sum( np.isclose([ utils._get_bin_index(0.05, self.edges), utils._get_bin_index(1.04, self.edges), utils._get_bin_index(99.95, self.edges) ], [0, 1, 99])) == 3, "The wrong bin for within the bin is given."
def test_inclusive_right_edge_top_bin(self): assert utils._get_bin_index(100, self.edges) == 99,\ "The right edge of the top bin in not inclusive."
def test_inclusive_left_edge_bottom_bin(self): assert utils._get_bin_index(0, self.edges) == 0,\ "The left edge of the bottom bin is not inclusive."
def test_on_edge(self): assert utils._get_bin_index(1, self.edges) == 1,\ "The wrong bin is returned for an edge."
def test_above_highest_edge(self): with pytest.raises(HokiFormatError): utils._get_bin_index(101, self.edges)
def test_below_lowest_edge(self): with pytest.raises(HokiFormatError): utils._get_bin_index(-1, self.edges)