<s> """<STR_LIT>""" <EOL> import numpy as np <EOL> import holoviews as hv <EOL> from holoviews . element . comparison import ComparisonTestCase <EOL> class TestEllipsisCharts ( ComparisonTestCase ) : <EOL> def test_curve_ellipsis_slice_x ( self ) : <EOL> sliced = hv . Curve ( [ ( i , <NUM_LIT:2> * i ) for i in range ( <NUM_LIT:10> ) ] ) [ <NUM_LIT:2> : <NUM_LIT:7> , ... ] <EOL> self . assertEqual ( sliced . range ( '<STR_LIT:x>' ) , ( <NUM_LIT:2> , <NUM_LIT:6> ) ) <EOL> def test_curve_ellipsis_slice_y ( self ) : <EOL> sliced = hv . Curve ( [ ( i , <NUM_LIT:2> * i ) for i in range ( <NUM_LIT:10> ) ] ) [ ... , <NUM_LIT:3> : <NUM_LIT:9> ] <EOL> self . assertEqual ( sliced . range ( '<STR_LIT:y>' ) , ( <NUM_LIT:4> , <NUM_LIT:8> ) ) <EOL> def test_points_ellipsis_slice_x ( self ) : <EOL> sliced = hv . Points ( [ ( i , <NUM_LIT:2> * i ) for i in range ( <NUM_LIT:10> ) ] ) [ <NUM_LIT:2> : <NUM_LIT:7> , ... ] <EOL> self . assertEqual ( sliced . range ( '<STR_LIT:x>' ) , ( <NUM_LIT:2> , <NUM_LIT:6> ) ) <EOL> def test_scatter_ellipsis_value ( self ) : <EOL> hv . Scatter ( range ( <NUM_LIT:10> ) ) [ ... , '<STR_LIT:y>' ] <EOL> def test_scatter_ellipsis_value_missing ( self ) : <EOL> try : <EOL> hv . Scatter ( range ( <NUM_LIT:10> ) ) [ ... , '<STR_LIT>' ] <EOL> except Exception as e : <EOL> if str ( e ) != "<STR_LIT>" : <EOL> raise AssertionError ( "<STR_LIT>" ) <EOL> def test_points_ellipsis_slice_y ( self ) : <EOL> sliced = hv . Points ( [ ( i , <NUM_LIT:2> * i ) for i in range ( <NUM_LIT:10> ) ] ) [ ... , <NUM_LIT:3> : <NUM_LIT:9> ] <EOL> self . assertEqual ( sliced . range ( '<STR_LIT:y>' ) , ( <NUM_LIT:4> , <NUM_LIT:8> ) ) <EOL> def test_histogram_ellipsis_slice_value ( self ) : <EOL> frequencies , edges = np . histogram ( range ( <NUM_LIT:20> ) , <NUM_LIT:20> ) <EOL> sliced = hv . Histogram ( frequencies , edges ) [ ... , '<STR_LIT>' ] <EOL> self . assertEqual ( len ( sliced . data [ <NUM_LIT:0> ] ) , <NUM_LIT:20> ) <EOL> def test_histogram_ellipsis_slice_range ( self ) : <EOL> frequencies , edges = np . histogram ( range ( <NUM_LIT:20> ) , <NUM_LIT:20> ) <EOL> sliced = hv . Histogram ( frequencies , edges ) [ <NUM_LIT:0> : <NUM_LIT:5> , ... ] <EOL> self . assertEqual ( len ( sliced . data [ <NUM_LIT:0> ] ) , <NUM_LIT:5> ) <EOL> def test_histogram_ellipsis_slice_value_missing ( self ) : <EOL> frequencies , edges = np . histogram ( range ( <NUM_LIT:20> ) , <NUM_LIT:20> ) <EOL> try : <EOL> hv . Histogram ( frequencies , edges ) [ ... , '<STR_LIT>' ] <EOL> raise AssertionError ( "<STR_LIT>" ) <EOL> except Exception as e : <EOL> if str ( e ) != repr ( "<STR_LIT>" ) : <EOL> raise AssertionError ( "<STR_LIT>" ) <EOL> class TestEllipsisTable ( ComparisonTestCase ) : <EOL> def setUp ( self ) : <EOL> keys = [ ( '<STR_LIT:M>' , <NUM_LIT:10> ) , ( '<STR_LIT:M>' , <NUM_LIT:16> ) , ( '<STR_LIT:F>' , <NUM_LIT:12> ) ] <EOL> values = [ ( <NUM_LIT:15> , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT> ) , ( <NUM_LIT:10> , <NUM_LIT> ) ] <EOL> self . table = hv . Table ( zip ( keys , values ) , <EOL> kdims = [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> vdims = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> super ( TestEllipsisTable , self ) . setUp ( ) <EOL> def test_table_ellipsis_slice_value_weight ( self ) : <EOL> sliced = self . table [ ... , '<STR_LIT>' ] <EOL> assert sliced . vdims == [ '<STR_LIT>' ] <EOL> def test_table_ellipsis_slice_value_height ( self ) : <EOL> sliced = self . table [ ... , '<STR_LIT>' ] <EOL> assert sliced . vdims == [ '<STR_LIT>' ] <EOL> def test_table_ellipsis_slice_key_gender ( self ) : <EOL> sliced = self . table [ '<STR_LIT:M>' , ... ] <EOL> if not all ( el == '<STR_LIT:M>' for el in sliced . dimension_values ( '<STR_LIT>' ) ) : <EOL> raise AssertionError ( "<STR_LIT>" ) <EOL> class TestEllipsisRaster ( ComparisonTestCase ) : <EOL> def test_raster_ellipsis_slice_value ( self ) : <EOL> data = np . random . rand ( <NUM_LIT:10> , <NUM_LIT:10> ) <EOL> sliced = hv . Raster ( data ) [ ... , '<STR_LIT:z>' ] <EOL> self . assertEqual ( sliced . data , data ) <EOL> def test_raster_ellipsis_slice_value_missing ( self ) : <EOL> data = np . random . rand ( <NUM_LIT:10> , <NUM_LIT:10> ) <EOL> try : <EOL> hv . Raster ( data ) [ ... , '<STR_LIT>' ] <EOL> except Exception as e : <EOL> if str ( e ) != repr ( "<STR_LIT>" ) : <EOL> raise AssertionError ( "<STR_LIT>" ) <EOL> def test_image_ellipsis_slice_value ( self ) : <EOL> data = np . random . rand ( <NUM_LIT:10> , <NUM_LIT:10> ) <EOL> sliced = hv . Image ( data ) [ ... , '<STR_LIT:z>' ] <EOL> self . assertEqual ( sliced . data , data ) <EOL> def test_image_ellipsis_slice_value_missing ( self ) : <EOL> data = np . random . rand ( <NUM_LIT:10> , <NUM_LIT:10> ) <EOL> try : <EOL> hv . Image ( data ) [ ... , '<STR_LIT>' ] <EOL> except Exception as e : <EOL> if str ( e ) != repr ( "<STR_LIT>" ) : <EOL> raise AssertionError ( "<STR_LIT>" ) <EOL> def test_rgb_ellipsis_slice_value ( self ) : <EOL> data = np . random . rand ( <NUM_LIT:10> , <NUM_LIT:10> , <NUM_LIT:3> ) <EOL> sliced = hv . RGB ( data ) [ : , : , '<STR_LIT:R>' ] <EOL> self . assertEqual ( sliced . data , data [ : , : , <NUM_LIT:0> ] ) <EOL> def test_rgb_ellipsis_slice_value_missing ( self ) : <EOL> rgb = hv . RGB ( np . random . rand ( <NUM_LIT:10> , <NUM_LIT:10> , <NUM_LIT:3> ) ) <EOL> try : <EOL> rgb [ ... , '<STR_LIT>' ] <EOL> except Exception as e : <EOL> if str ( e ) != repr ( "<STR_LIT>" ) : <EOL> raise AssertionError ( "<STR_LIT>" ) <EOL> class TestEllipsisDeepIndexing ( ComparisonTestCase ) : <EOL> def test_deep_ellipsis_curve_slicing_1 ( self ) : <EOL> hmap = hv . HoloMap ( { i : hv . Curve ( [ ( j , j ) for j in range ( <NUM_LIT:10> ) ] ) <EOL> for i in range ( <NUM_LIT:10> ) } ) <EOL> sliced = hmap [ <NUM_LIT:2> : <NUM_LIT:5> , ... ] <EOL> self . assertEqual ( sliced . keys ( ) , [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] ) <EOL> def test_deep_ellipsis_curve_slicing_2 ( self ) : <EOL> hmap = hv . HoloMap ( { i : hv . Curve ( [ ( j , j ) for j in range ( <NUM_LIT:10> ) ] ) <EOL> for i in range ( <NUM_LIT:10> ) } ) <EOL> sliced = hmap [ <NUM_LIT:2> : <NUM_LIT:5> , <NUM_LIT:1> : <NUM_LIT:8> , ... ] <EOL> self . assertEqual ( sliced . last . range ( '<STR_LIT:x>' ) , ( <NUM_LIT:1> , <NUM_LIT:7> ) ) <EOL> def test_deep_ellipsis_curve_slicing_3 ( self ) : <EOL> hmap = hv . HoloMap ( { i : hv . Curve ( [ ( j , <NUM_LIT:2> * j ) for j in range ( <NUM_LIT:10> ) ] ) <EOL> for i in range ( <NUM_LIT:10> ) } ) <EOL> sliced = hmap [ ... , <NUM_LIT:2> : <NUM_LIT:5> ] <EOL> self . assertEqual ( sliced . last . range ( '<STR_LIT:y>' ) , ( <NUM_LIT:2> , <NUM_LIT:4> ) ) </s>
