11import pytest , io , sys , json , mock , re , os
22
3- @pytest .mark .it ('Your solution should work as expected' )
3+ @pytest .mark .it ('The function divisable_binary must exist' )
4+ def test_function_existence (capsys , app ):
5+ assert app .divisable_binary
6+
7+ @pytest .mark .it ('The function should return the expected output' )
48def test_expected_output (capsys , app ):
5- fake_input = ['0100,0011,1010,1001' ]
6- with mock .patch ('builtins.input' , lambda x : fake_input .pop ()):
7- app ()
8- captured = capsys .readouterr ()
9- assert captured .out == "1010\n "
9+ assert app .divisable_binary ("0100,0011,1010,1001" ) == "1010"
1010
11- @pytest .mark .it ('Your solution should work with other parameters' )
11+ @pytest .mark .it ('The function should work with other parameters. testing with 1111,1000,0101,0000 ' )
1212def test_expected_output_2 (capsys , app ):
13- fake_input = [ ' 1111,1000,0101,0000' ]
14- with mock . patch ( 'builtins.input' , lambda x : fake_input . pop ()):
15- app ( )
16- captured = capsys . readouterr ()
17- assert captured . out == "1111,0101,0000 \n "
13+ assert app . divisable_binary ( " 1111,1000,0101,0000" ) == "1111,0101,0000"
14+
15+ @ pytest . mark . it ( "The function should work with other parameters. Testing with 1000" )
16+ def test_expected_output_3 ( capsys , app ):
17+ assert app . divisable_binary ( "1000,1000,1000,1000" ) == ""
0 commit comments