def test_json_feature_conversion_bad_output_file(self): json_feature_file = join(_MY_DIR, 'data', 'experiments', 'lr-feature-json', 'features.json') # convert the feature json file and write to a temporary location tempf = tempfile.NamedTemporaryFile(mode='w', suffix='.txt', delete=False) convert_feature_json_file(json_feature_file, tempf.name, delete=False)
def test_json_feature_conversion_bad_output_file(self): json_feature_file = join(_MY_DIR, 'data', 'experiments', 'lr-feature-json', 'features.json') # convert the feature json file and write to a temporary location tempf = tempfile.NamedTemporaryFile(mode='w', suffix='.txt', delete=False) convert_feature_json_file(json_feature_file, tempf.name, delete=False)
def test_json_feature_conversion(self): json_feature_file = join(_MY_DIR, 'data', 'experiments', 'lr-feature-json', 'features.json') expected_feature_csv = join(_MY_DIR, 'data', 'experiments', 'lr', 'features.csv') # convert the feature json file and write to a temporary location tempf = tempfile.NamedTemporaryFile(mode='w', suffix='.csv', delete=False) convert_feature_json_file(json_feature_file, tempf.name, delete=False) # read the expected and converted files into data frames df_expected = pd.read_csv(expected_feature_csv) df_converted = pd.read_csv(tempf.name) tempf.close() # get rid of the file now that have read it into memory os.unlink(tempf.name) assert_frame_equal(df_expected, df_converted)
def test_json_feature_conversion(self): json_feature_file = join(_MY_DIR, 'data', 'experiments', 'lr-feature-json', 'features.json') expected_feature_csv = join(_MY_DIR, 'data', 'experiments', 'lr', 'features.csv') # convert the feature json file and write to a temporary location tempf = tempfile.NamedTemporaryFile(mode='w', suffix='.csv', delete=False) convert_feature_json_file(json_feature_file, tempf.name, delete=False) # read the expected and converted files into data frames df_expected = pd.read_csv(expected_feature_csv) df_converted = pd.read_csv(tempf.name) tempf.close() # get rid of the file now that have read it into memory os.unlink(tempf.name) assert_frame_equal(df_expected, df_converted)