def test_generate_dummies2(): testing_df = df.copy() testing_df['col4'] = pd.Series(['hello'], index = [2]) result_df = testing_df.copy() clean.generateDummies(testing_df, 3 , False) result_df.insert(4, 'col4_hello', [0,0,1,0,0], allow_duplicates=True) assert (((testing_df.fillna(0) == result_df.fillna(0)).all()).all()) == True
def test_generate_dummies1(): testing_df = df.copy() result_df = df.copy() clean.generateDummies(testing_df, 0 , False) result_df.insert(1, 'col1_1.0', [1,0,0,0,0], allow_duplicates=True) result_df.insert(2, 'col1_2.0', [0,1,0,0,0], allow_duplicates=True) result_df.insert(3, 'col1_3.0', [0,0,0,1,0], allow_duplicates=True) result_df.insert(4, 'col1_4.0', [0,0,0,0,1], allow_duplicates=True) assert (((testing_df.fillna(0) == result_df.fillna(0)).all()).all()) == True
def test_generate_dummmies3(): testing_df = df.copy() with pytest.raises(Exception): clean.generateDummies(testing_df, 30 , False)