<s> import datetime <EOL> from django . test import SimpleTestCase <EOL> from . test_data_source_config import get_sample_data_source <EOL> from . . sql import get_indicator_table <EOL> from . . views import process_url_params <EOL> class ParameterTest ( SimpleTestCase ) : <EOL> def setUp ( self ) : <EOL> config = get_sample_data_source ( ) <EOL> self . columns = get_indicator_table ( config ) . columns <EOL> def test_no_parameters ( self ) : <EOL> params = process_url_params ( { } , self . columns ) <EOL> self . assertEqual ( params . format , '<STR_LIT>' ) <EOL> self . assertEqual ( params . keyword_filters , { } ) <EOL> self . assertEqual ( params . sql_filters , [ ] ) <EOL> def test_lastndays ( self ) : <EOL> params = process_url_params ( { '<STR_LIT>' : '<STR_LIT>' } , self . columns ) <EOL> result_filter = params . sql_filters [ <NUM_LIT:0> ] <EOL> end = datetime . date . today ( ) <EOL> start = end - datetime . timedelta ( days = <NUM_LIT:30> ) <EOL> date_column = self . columns [ '<STR_LIT:date>' ] <EOL> desired_filter = date_column . between ( start , end ) <EOL> self . assertTrue ( result_filter . compare ( desired_filter ) ) <EOL> def test_range_filter ( self ) : <EOL> params = process_url_params ( { '<STR_LIT>' : '<STR_LIT>' } , self . columns ) <EOL> result_filter = params . sql_filters [ <NUM_LIT:0> ] <EOL> count_column = self . columns [ '<STR_LIT:count>' ] <EOL> desired_filter = count_column . between ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertTrue ( result_filter . compare ( desired_filter ) ) </s>
