<s> import sys <EOL> import six <EOL> try : <EOL> from mock import patch <EOL> except ImportError : <EOL> from unittest . mock import patch <EOL> from csvkit . utilities . in2csv import In2CSV , launch_new_instance <EOL> from tests . utils import CSVKitTestCase , EmptyFileTests , stdin_as_string <EOL> class TestIn2CSV ( CSVKitTestCase , EmptyFileTests ) : <EOL> Utility = In2CSV <EOL> default_args = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> def assertConverted ( self , input_format , input_filename , output_filename , additional_args = [ ] ) : <EOL> output = self . get_output ( [ '<STR_LIT>' , input_format , input_filename ] + additional_args ) <EOL> self . assertEqual ( output , open ( output_filename , '<STR_LIT:r>' ) . read ( ) ) <EOL> def test_launch_new_instance ( self ) : <EOL> with patch . object ( sys , '<STR_LIT>' , [ self . Utility . __name__ . lower ( ) , '<STR_LIT>' ] ) : <EOL> launch_new_instance ( ) <EOL> def test_convert_csv ( self ) : <EOL> self . assertConverted ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_convert_dbf ( self ) : <EOL> self . assertConverted ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_convert_json ( self ) : <EOL> self . assertConverted ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_convert_geojson ( self ) : <EOL> self . assertConverted ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_convert_ndjson ( self ) : <EOL> self . assertConverted ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_convert_nested_json ( self ) : <EOL> self . assertConverted ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_convert_xls ( self ) : <EOL> self . assertConverted ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_convert_xls_with_sheet ( self ) : <EOL> self . assertConverted ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT:data>' ] ) <EOL> def test_convert_xlsx ( self ) : <EOL> self . assertConverted ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_convert_xlsx_with_sheet ( self ) : <EOL> self . assertConverted ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT:data>' ] ) <EOL> def test_csv_no_headers ( self ) : <EOL> self . assertLines ( [ '<STR_LIT>' , '<STR_LIT>' ] , [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] ) <EOL> def test_csv_datetime_inference ( self ) : <EOL> input_file = six . StringIO ( '<STR_LIT>' ) <EOL> with stdin_as_string ( input_file ) : <EOL> self . assertLines ( [ '<STR_LIT>' , '<STR_LIT>' ] , [ <EOL> '<STR_LIT:a>' , <EOL> '<STR_LIT>' , <EOL> ] ) <EOL> def test_csv_no_inference ( self ) : <EOL> self . assertLines ( [ '<STR_LIT>' , '<STR_LIT>' ] , [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] ) <EOL> def test_geojson_no_inference ( self ) : <EOL> input_file = six . StringIO ( '<STR_LIT>' ) <EOL> with stdin_as_string ( input_file ) : <EOL> self . assertLines ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] ) <EOL> def test_json_no_inference ( self ) : <EOL> input_file = six . StringIO ( '<STR_LIT>' ) <EOL> with stdin_as_string ( input_file ) : <EOL> self . assertLines ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] ) <EOL> def test_ndjson_no_inference ( self ) : <EOL> input_file = six . StringIO ( '<STR_LIT>' ) <EOL> with stdin_as_string ( input_file ) : <EOL> self . assertLines ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] ) </s>
