<s> import unittest <EOL> from . import cpu_stat <EOL> class TestCPUStats ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . sample_duration = <NUM_LIT> <EOL> def test_cpu_info ( self ) : <EOL> values = cpu_stat . cpu_info ( ) <EOL> self . assertTrue ( len ( values ) > <NUM_LIT:0> , values ) <EOL> def test_cpu_percent_idle ( self ) : <EOL> value = cpu_stat . cpu_percents ( self . sample_duration ) [ '<STR_LIT>' ] <EOL> self . assertTrue ( <NUM_LIT:0.0> <= value <= <NUM_LIT> , value ) <EOL> def test_cpu_percent_iowait ( self ) : <EOL> value = cpu_stat . cpu_percents ( self . sample_duration ) [ '<STR_LIT>' ] <EOL> self . assertTrue ( <NUM_LIT:0.0> <= value <= <NUM_LIT> , value ) <EOL> def test_cpu_percent_irq ( self ) : <EOL> value = cpu_stat . cpu_percents ( self . sample_duration ) [ '<STR_LIT>' ] <EOL> self . assertTrue ( <NUM_LIT:0.0> <= value <= <NUM_LIT> , value ) <EOL> def test_cpu_percent_nice ( self ) : <EOL> value = cpu_stat . cpu_percents ( self . sample_duration ) [ '<STR_LIT>' ] <EOL> self . assertTrue ( <NUM_LIT:0.0> <= value <= <NUM_LIT> , value ) <EOL> def test_cpu_percent_softirq ( self ) : <EOL> value = cpu_stat . cpu_percents ( self . sample_duration ) [ '<STR_LIT>' ] <EOL> self . assertTrue ( <NUM_LIT:0.0> <= value <= <NUM_LIT> , value ) <EOL> def test_cpu_percent_system ( self ) : <EOL> value = cpu_stat . cpu_percents ( self . sample_duration ) [ '<STR_LIT>' ] <EOL> self . assertTrue ( <NUM_LIT:0.0> <= value <= <NUM_LIT> , value ) <EOL> def test_cpu_percent_user ( self ) : <EOL> value = cpu_stat . cpu_percents ( self . sample_duration ) [ '<STR_LIT:user>' ] <EOL> self . assertTrue ( <NUM_LIT:0.0> <= value <= <NUM_LIT> , value ) <EOL> def test_cpu_percents ( self ) : <EOL> values = cpu_stat . cpu_percents ( self . sample_duration ) <EOL> self . assertTrue ( len ( values ) == <NUM_LIT:7> , values ) <EOL> def test_cpu_times ( self ) : <EOL> values = cpu_stat . cpu_times ( ) <EOL> self . assertTrue ( len ( values ) >= <NUM_LIT:7> , values ) <EOL> def test_procs_blocked ( self ) : <EOL> value = cpu_stat . procs_blocked ( ) <EOL> self . assertTrue ( value >= <NUM_LIT:0> , value ) <EOL> def test_procs_running ( self ) : <EOL> value = cpu_stat . procs_running ( ) <EOL> self . assertTrue ( value >= <NUM_LIT:0> , value ) <EOL> def test_load_avg ( self ) : <EOL> values = cpu_stat . load_avg ( ) <EOL> self . assertTrue ( len ( values ) == <NUM_LIT:3> , values ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> test_suite = unittest . TestLoader ( ) . loadTestsFromTestCase ( TestCPUStats ) <EOL> unittest . TextTestRunner ( verbosity = <NUM_LIT:2> ) . run ( test_suite ) </s>
