<s> from mock import patch , MagicMock <EOL> from unittest import TestCase <EOL> from pandashells . bin . p_rand import fill_default_mu , main <EOL> class TestFillDefaultMu ( TestCase ) : <EOL> def test_normal_mu_default ( self ) : <EOL> args = MagicMock ( type = [ '<STR_LIT>' ] , mu = None ) <EOL> fill_default_mu ( args ) <EOL> self . assertEqual ( args . mu , [ <NUM_LIT:0.> ] ) <EOL> def test_normal_mu_non_default ( self ) : <EOL> args = MagicMock ( type = [ '<STR_LIT>' ] , mu = [ <NUM_LIT> ] ) <EOL> fill_default_mu ( args ) <EOL> self . assertEqual ( args . mu , [ <NUM_LIT> ] ) <EOL> def test_poisson_mu_default ( self ) : <EOL> args = MagicMock ( type = [ '<STR_LIT>' ] , mu = None ) <EOL> fill_default_mu ( args ) <EOL> self . assertEqual ( args . mu , [ <NUM_LIT:1.> ] ) <EOL> def test_poisson_mu_non_default ( self ) : <EOL> args = MagicMock ( type = [ '<STR_LIT>' ] , mu = [ <NUM_LIT> ] ) <EOL> fill_default_mu ( args ) <EOL> self . assertEqual ( args . mu , [ <NUM_LIT> ] ) <EOL> class TestMain ( TestCase ) : <EOL> @ patch ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' . split ( ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_uniform ( self , df_to_output_mock ) : <EOL> main ( ) <EOL> df = df_to_output_mock . call_args_list [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] <EOL> self . assertEqual ( len ( df ) , <NUM_LIT:10> ) <EOL> self . assertTrue ( all ( [ x <= <NUM_LIT:1> for x in df . c0 ] ) ) <EOL> self . assertTrue ( all ( [ x >= <NUM_LIT:0> for x in df . c0 ] ) ) <EOL> @ patch ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' . split ( ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_normal ( self , df_to_output_mock ) : <EOL> main ( ) <EOL> df = df_to_output_mock . call_args_list [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] <EOL> self . assertEqual ( len ( df ) , <NUM_LIT:10> ) <EOL> self . assertTrue ( df . c0 . mean ( ) < <NUM_LIT:100> ) <EOL> self . assertTrue ( df . c0 . mean ( ) > - <NUM_LIT:100> ) <EOL> @ patch ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' . split ( ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_poisson ( self , df_to_output_mock ) : <EOL> main ( ) <EOL> df = df_to_output_mock . call_args_list [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] <EOL> self . assertEqual ( len ( df ) , <NUM_LIT:10> ) <EOL> self . assertTrue ( all ( [ round ( x , <NUM_LIT:0> ) == x for x in df . c0 ] ) ) <EOL> self . assertTrue ( all ( [ x >= <NUM_LIT:0> for x in df . c0 ] ) ) <EOL> @ patch ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' . split ( ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_beta ( self , df_to_output_mock ) : <EOL> main ( ) <EOL> df = df_to_output_mock . call_args_list [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] <EOL> self . assertEqual ( len ( df ) , <NUM_LIT:10> ) <EOL> self . assertTrue ( all ( [ x >= <NUM_LIT:0> for x in df . c0 ] ) ) <EOL> self . assertTrue ( all ( [ x <= <NUM_LIT:1> for x in df . c0 ] ) ) <EOL> @ patch ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' . split ( ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_gamma ( self , df_to_output_mock ) : <EOL> main ( ) <EOL> df = df_to_output_mock . call_args_list [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] <EOL> self . assertEqual ( len ( df ) , <NUM_LIT:10> ) <EOL> self . assertTrue ( all ( [ x >= <NUM_LIT:0> for x in df . c0 ] ) ) <EOL> @ patch ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' . split ( ) ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_binomial ( self , df_to_output_mock ) : <EOL> main ( ) <EOL> df = df_to_output_mock . call_args_list [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] <EOL> self . assertEqual ( len ( df ) , <NUM_LIT:10> ) <EOL> self . assertTrue ( all ( [ round ( x , <NUM_LIT:0> ) == x for x in df . c0 ] ) ) <EOL> self . assertTrue ( all ( [ x >= <NUM_LIT:0> for x in df . c0 ] ) ) <EOL> self . assertTrue ( all ( [ x <= <NUM_LIT:10> for x in df . c0 ] ) ) </s>
