<s> """<STR_LIT>""" <EOL> import sys <EOL> import pytest <EOL> from pyweet import base <EOL> from pyweet . base import parse_args <EOL> @ pytest . fixture ( autouse = True ) <EOL> def setup_argv ( request ) : <EOL> """<STR_LIT>""" <EOL> request . addfinalizer ( reset_argv ) <EOL> @ pytest . fixture <EOL> def reset_argv ( ) : <EOL> """<STR_LIT>""" <EOL> while len ( sys . argv ) > <NUM_LIT:1> : <EOL> sys . argv . pop ( - <NUM_LIT:1> ) <EOL> def test_max_tweets ( ) : <EOL> """<STR_LIT>""" <EOL> sys . argv . append ( "<STR_LIT>" ) <EOL> settings = parse_args ( ) <EOL> assert settings . get ( "<STR_LIT>" ) == <NUM_LIT> <EOL> def test_search_phrase_with_hyphen ( ) : <EOL> """<STR_LIT>""" <EOL> sys . argv . append ( "<STR_LIT>" ) <EOL> settings = parse_args ( ) <EOL> assert settings . get ( "<STR_LIT>" ) == <NUM_LIT:3> <EOL> assert settings . get ( "<STR_LIT>" ) == [ "<STR_LIT>" ] <EOL> def test_search_tweets ( ) : <EOL> """<STR_LIT>""" <EOL> sys . argv . append ( "<STR_LIT>" ) <EOL> settings = parse_args ( ) <EOL> assert settings . get ( "<STR_LIT>" ) == [ "<STR_LIT>" ] <EOL> def test_multiple_phrases ( ) : <EOL> """<STR_LIT>""" <EOL> sys . argv . extend ( [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> settings = parse_args ( ) <EOL> assert settings . get ( "<STR_LIT>" ) == [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> def test_user_tweets ( ) : <EOL> """<STR_LIT>""" <EOL> sys . argv . extend ( [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> settings = parse_args ( ) <EOL> assert settings . get ( "<STR_LIT:user>" ) == "<STR_LIT>" <EOL> def test_stream ( ) : <EOL> """<STR_LIT>""" <EOL> sys . argv . append ( "<STR_LIT>" ) <EOL> with pytest . raises ( SystemExit ) : <EOL> parse_args ( ) <EOL> def test_date_flag ( ) : <EOL> """<STR_LIT>""" <EOL> sys . argv . append ( "<STR_LIT>" ) <EOL> settings = parse_args ( ) <EOL> assert settings . get ( "<STR_LIT:date>" ) <EOL> def test_time_flag ( ) : <EOL> """<STR_LIT>""" <EOL> sys . argv . append ( "<STR_LIT>" ) <EOL> settings = parse_args ( ) <EOL> assert settings . get ( "<STR_LIT:time>" ) <EOL> def test_time_and_date_flags ( ) : <EOL> """<STR_LIT>""" <EOL> sys . argv . extend ( [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> settings = parse_args ( ) <EOL> assert settings . get ( "<STR_LIT:date>" ) <EOL> assert settings . get ( "<STR_LIT:time>" ) <EOL> def test_time_date_and_stream_flags ( ) : <EOL> """<STR_LIT>""" <EOL> sys . argv . extend ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> settings = parse_args ( ) <EOL> assert settings . get ( "<STR_LIT:date>" ) <EOL> assert settings . get ( "<STR_LIT:time>" ) <EOL> assert settings . get ( "<STR_LIT>" ) <EOL> assert settings . get ( "<STR_LIT>" , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> def test_spam_flag ( ) : <EOL> """<STR_LIT>""" <EOL> sys . argv . append ( "<STR_LIT>" ) <EOL> settings = parse_args ( ) <EOL> assert settings . get ( "<STR_LIT>" ) <EOL> def test_json_flag ( ) : <EOL> """<STR_LIT>""" <EOL> sys . argv . append ( "<STR_LIT>" ) <EOL> settings = parse_args ( ) <EOL> assert settings . get ( "<STR_LIT>" ) <EOL> def test_negative_search ( ) : <EOL> """<STR_LIT>""" <EOL> sys . argv . extend ( [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> settings = parse_args ( ) <EOL> assert settings . get ( "<STR_LIT>" ) == [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> def test_help ( ) : <EOL> """<STR_LIT>""" <EOL> sys . argv . extend ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> with pytest . raises ( SystemExit ) as raises : <EOL> parse_args ( ) <EOL> assert base . __doc__ . strip ( ) in raises . value . args <EOL> def test_max_with_negative_search ( ) : <EOL> """<STR_LIT>""" <EOL> sys . argv . extend ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> settings = parse_args ( ) <EOL> assert settings . get ( "<STR_LIT>" ) == <NUM_LIT:6> <EOL> assert settings . get ( "<STR_LIT>" ) == [ "<STR_LIT>" , "<STR_LIT>" ] </s>
