<s> """<STR_LIT>""" <EOL> import numpy as np <EOL> from holoviews import Histogram <EOL> from holoviews . element . comparison import ComparisonTestCase <EOL> class HistogramIndexingTest ( ComparisonTestCase ) : <EOL> def setUp ( self ) : <EOL> self . values = [ i for i in range ( <NUM_LIT:10> ) ] <EOL> self . edges = [ i for i in range ( <NUM_LIT:11> ) ] <EOL> self . hist = Histogram ( self . values , self . edges ) <EOL> def test_slice_all ( self ) : <EOL> sliced = self . hist [ : ] <EOL> self . assertEqual ( np . all ( sliced . values == self . values ) , True ) <EOL> self . assertEqual ( np . all ( sliced . edges == self . edges ) , True ) <EOL> def test_slice_exclusive_upper ( self ) : <EOL> "<STR_LIT>" <EOL> sliced = self . hist [ : <NUM_LIT> ] <EOL> self . assertEqual ( np . all ( sliced . values == [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] ) , True ) <EOL> self . assertEqual ( np . all ( sliced . edges == [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> ] ) , True ) <EOL> def test_slice_exclusive_upper_exceeded ( self ) : <EOL> "<STR_LIT>" <EOL> sliced = self . hist [ : <NUM_LIT> ] <EOL> self . assertEqual ( np . all ( sliced . values == [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> ] ) , True ) <EOL> self . assertEqual ( np . all ( sliced . edges == [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> ] ) , True ) <EOL> def test_slice_inclusive_lower ( self ) : <EOL> "<STR_LIT>" <EOL> sliced = self . hist [ <NUM_LIT> : ] <EOL> self . assertEqual ( np . all ( sliced . values == [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:9> ] ) , True ) <EOL> self . assertEqual ( np . all ( sliced . edges == [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:10> ] ) , True ) <EOL> def test_slice_inclusive_lower_undershot ( self ) : <EOL> "<STR_LIT>" <EOL> sliced = self . hist [ <NUM_LIT> : ] <EOL> self . assertEqual ( np . all ( sliced . values == [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:9> ] ) , True ) <EOL> self . assertEqual ( np . all ( sliced . edges == [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:10> ] ) , True ) <EOL> def test_slice_bounded ( self ) : <EOL> sliced = self . hist [ <NUM_LIT> : <NUM_LIT> ] <EOL> self . assertEqual ( np . all ( sliced . values == [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] ) , True ) <EOL> self . assertEqual ( np . all ( sliced . edges == [ <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> ] ) , True ) <EOL> def test_slice_lower_out_of_bounds ( self ) : <EOL> sliced = self . hist [ - <NUM_LIT:3> : ] <EOL> self . assertEqual ( np . all ( sliced . values == self . values ) , True ) <EOL> self . assertEqual ( np . all ( sliced . edges == self . edges ) , True ) <EOL> def test_slice_upper_out_of_bounds ( self ) : <EOL> sliced = self . hist [ : <NUM_LIT:12> ] <EOL> self . assertEqual ( np . all ( sliced . values == self . values ) , True ) <EOL> self . assertEqual ( np . all ( sliced . edges == self . edges ) , True ) <EOL> def test_slice_both_out_of_bounds ( self ) : <EOL> sliced = self . hist [ - <NUM_LIT:3> : <NUM_LIT> ] <EOL> self . assertEqual ( np . all ( sliced . values == self . values ) , True ) <EOL> self . assertEqual ( np . all ( sliced . edges == self . edges ) , True ) <EOL> def test_scalar_index ( self ) : <EOL> self . assertEqual ( self . hist [ <NUM_LIT> ] , <NUM_LIT:4> ) <EOL> self . assertEqual ( self . hist [ <NUM_LIT> ] , <NUM_LIT:3> ) <EOL> self . assertEqual ( self . hist [ <NUM_LIT> ] , <NUM_LIT:9> ) <EOL> def test_scalar_index_boundary ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( self . hist [ <NUM_LIT:4> ] , <NUM_LIT:4> ) <EOL> self . assertEqual ( self . hist [ <NUM_LIT:5> ] , <NUM_LIT:5> ) <EOL> def test_scalar_lowest_index ( self ) : <EOL> self . assertEqual ( self . hist [ <NUM_LIT:0> ] , <NUM_LIT:0> ) <EOL> def test_scalar_lowest_index_out_of_bounds ( self ) : <EOL> try : <EOL> self . hist [ - <NUM_LIT:0.1> ] <EOL> except Exception as e : <EOL> if not str ( e ) . startswith ( "<STR_LIT>" ) : <EOL> raise AssertionError ( "<STR_LIT>" ) <EOL> def test_scalar_highest_index_out_of_bounds ( self ) : <EOL> try : <EOL> self . hist [ <NUM_LIT:10> ] <EOL> except Exception as e : <EOL> if not str ( e ) . startswith ( "<STR_LIT>" ) : <EOL> raise AssertionError ( "<STR_LIT>" ) </s>
