<s> import sys <EOL> from tap . formatter import format_as_diagnostics , format_exception <EOL> from tap . tests import TestCase <EOL> class TestFormatter ( TestCase ) : <EOL> def test_formats_as_diagnostics ( self ) : <EOL> data = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> expected_diagnostics = '<STR_LIT>' <EOL> diagnostics = format_as_diagnostics ( data ) <EOL> self . assertEqual ( expected_diagnostics , diagnostics ) <EOL> def test_format_exception_as_diagnostics ( self ) : <EOL> try : <EOL> raise ValueError ( '<STR_LIT>' ) <EOL> except ValueError : <EOL> exc = sys . exc_info ( ) <EOL> diagnostics = format_exception ( exc ) <EOL> self . assertTrue ( diagnostics . startswith ( '<STR_LIT>' ) ) <EOL> self . assertTrue ( '<STR_LIT>' in diagnostics ) </s>
