<s> """<STR_LIT>""" <EOL> import unittest <EOL> from testtools . compat import StringIO <EOL> import subunit <EOL> class TestTAP2SubUnit ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . tap = StringIO ( ) <EOL> self . subunit = StringIO ( ) <EOL> def test_skip_entire_file ( self ) : <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT:]>" , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_ok_test_pass ( self ) : <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_ok_test_number_pass ( self ) : <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_ok_test_number_description_pass ( self ) : <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_ok_test_description_pass ( self ) : <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_ok_SKIP_skip ( self ) : <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_ok_skip_number_comment_lowercase ( self ) : <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT:]>" <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_ok_number_description_SKIP_skip_comment ( self ) : <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT:]>" , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_ok_SKIP_skip_comment ( self ) : <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT:]>" , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_ok_TODO_xfail ( self ) : <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_ok_TODO_xfail_comment ( self ) : <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT:]>" , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_bail_out_errors ( self ) : <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_missing_test_at_end_with_plan_adds_error ( self ) : <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:]>' , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_missing_test_with_plan_adds_error ( self ) : <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:]>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_missing_test_no_plan_adds_error ( self ) : <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:]>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_four_tests_in_a_row_trailing_plan ( self ) : <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_four_tests_in_a_row_with_plan ( self ) : <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_four_tests_in_a_row_no_plan ( self ) : <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . write ( '<STR_LIT>' ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_todo_and_skip ( self ) : <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:]>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:]>' , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_leading_comments_add_to_next_test_log ( self ) : <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:]>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_trailing_comments_are_included_in_last_test_log ( self ) : <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . write ( "<STR_LIT>" ) <EOL> self . tap . seek ( <NUM_LIT:0> ) <EOL> result = subunit . TAP2SubUnit ( self . tap , self . subunit ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> self . assertEqual ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:]>' , <EOL> ] , <EOL> self . subunit . getvalue ( ) . splitlines ( ) ) <EOL> def test_suite ( ) : <EOL> loader = subunit . tests . TestUtil . TestLoader ( ) <EOL> result = loader . loadTestsFromName ( __name__ ) <EOL> return result </s>
