<s> import os . path <EOL> import numpy . testing as npt <EOL> import pandas as pd <EOL> import pandas . util . testing as pdt <EOL> import pytest <EOL> from . . import activitysim as asim <EOL> @ pytest . fixture ( scope = '<STR_LIT>' ) <EOL> def spec_name ( ) : <EOL> return os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT:data>' , '<STR_LIT>' ) <EOL> @ pytest . fixture ( scope = '<STR_LIT>' ) <EOL> def data_name ( ) : <EOL> return os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT:data>' , '<STR_LIT>' ) <EOL> @ pytest . fixture ( scope = '<STR_LIT>' ) <EOL> def desc_name ( ) : <EOL> return '<STR_LIT:description>' <EOL> @ pytest . fixture ( scope = '<STR_LIT>' ) <EOL> def expr_name ( ) : <EOL> return '<STR_LIT>' <EOL> @ pytest . fixture ( scope = '<STR_LIT>' ) <EOL> def spec ( spec_name , desc_name , expr_name ) : <EOL> return asim . read_model_spec ( <EOL> spec_name , description_name = desc_name , expression_name = expr_name ) <EOL> @ pytest . fixture ( scope = '<STR_LIT>' ) <EOL> def data ( data_name ) : <EOL> return pd . read_csv ( data_name ) <EOL> def test_read_model_spec ( spec_name , desc_name , expr_name ) : <EOL> spec = asim . read_model_spec ( <EOL> spec_name , description_name = desc_name , expression_name = expr_name ) <EOL> assert len ( spec ) == <NUM_LIT:4> <EOL> assert spec . index . name == '<STR_LIT>' <EOL> assert list ( spec . columns ) == [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> npt . assert_array_equal ( <EOL> spec . as_matrix ( ) , <EOL> [ [ <NUM_LIT> , <NUM_LIT:11> ] , [ <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT> , <NUM_LIT> ] ] ) <EOL> def test_eval_variables ( spec , data ) : <EOL> result = asim . eval_variables ( spec . index , data ) <EOL> pdt . assert_frame_equal ( <EOL> result , <EOL> pd . DataFrame ( [ <EOL> [ True , False , <NUM_LIT:4> , <NUM_LIT:1> ] , <EOL> [ False , True , <NUM_LIT:4> , <NUM_LIT:1> ] , <EOL> [ False , True , <NUM_LIT:5> , <NUM_LIT:1> ] ] , <EOL> index = data . index , columns = spec . index ) , <EOL> check_names = False ) <EOL> def test_simple_simulate ( random_seed , data , spec ) : <EOL> choices , _ = asim . simple_simulate ( data , spec ) <EOL> expected = pd . Series ( [ <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ] , index = data . index ) <EOL> pdt . assert_series_equal ( choices , expected ) </s>
