<s> """<STR_LIT>""" <EOL> import numpy as np <EOL> import pandas as pd <EOL> import pytest <EOL> from bokeh . sampledata . autompg import autompg <EOL> class TestData ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> self . cat_list = [ '<STR_LIT:a>' , '<STR_LIT:c>' , '<STR_LIT:a>' , '<STR_LIT:b>' ] <EOL> self . list_data = [ [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] , [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] ] <EOL> self . array_data = [ np . array ( item ) for item in self . list_data ] <EOL> self . dict_data = { '<STR_LIT>' : self . list_data [ <NUM_LIT:0> ] , <EOL> '<STR_LIT>' : self . list_data [ <NUM_LIT:1> ] } <EOL> self . pd_data = pd . DataFrame ( self . dict_data ) <EOL> self . records_data = self . pd_data . to_dict ( orient = '<STR_LIT>' ) <EOL> self . auto_data = autompg <EOL> self . _setup_auto_mpg ( ) <EOL> def _setup_auto_mpg ( self ) : <EOL> self . auto_data [ '<STR_LIT>' ] = self . auto_data [ '<STR_LIT>' ] > <NUM_LIT> <EOL> cat = pd . Categorical . from_array ( self . auto_data [ '<STR_LIT>' ] ) <EOL> new_order = list ( reversed ( sorted ( cat . categories . values . tolist ( ) ) ) ) <EOL> self . auto_data [ '<STR_LIT>' ] = cat . reorder_categories ( new_order ) <EOL> @ pytest . fixture ( scope = '<STR_LIT>' ) <EOL> def test_data ( ) : <EOL> return TestData ( ) <EOL> @ pytest . fixture ( scope = '<STR_LIT>' ) <EOL> def wide_data_with_cat ( test_data ) : <EOL> data = test_data . dict_data . copy ( ) <EOL> data [ '<STR_LIT>' ] = test_data . cat_list <EOL> return data <EOL> @ pytest . fixture ( scope = '<STR_LIT>' ) <EOL> def df_with_cat_index ( test_data ) : <EOL> return pd . DataFrame ( test_data . dict_data , index = test_data . cat_list ) </s>
