def test_left_12(self): files = [self.file1, self.file2] sep = ',' index = ['name', 'name'] how = ['left'] parse_dates = False null_fill = [] join_csv._join( self.outfile, files, sep, index, how, null_fill, parse_dates) result = self.outfile.getvalue() benchmark = 'name,age,height\n' + 'ian,1,11.0\n' + 'daniel,2,\n' self.assertEqual(result, benchmark)
def test_inner_123(self): files = [self.file1, self.file2, self.file3] sep = ',' index = ['name', 'name', 'myname'] how = ['inner'] parse_dates = False null_fill = [] join_csv._join( self.outfile, files, sep, index, how, null_fill, parse_dates) result = self.outfile.getvalue() benchmark = ',age,height,weight\n' + 'ian,1,11,111\n' self.assertEqual(result, benchmark)
def test_outer_14_null_fill(self): files = [self.file1, self.file4] sep = ',' index = ['name'] how = ['outer'] parse_dates = False null_fill = ['job,unemployed'] join_csv._join( self.outfile, files, sep, index, how, null_fill, parse_dates) result = self.outfile.getvalue() benchmark = ( 'name,age,job\n' 'daniel,2.0,unemployed\n' 'ian,1.0,tacobell\n' 'joe,,scrub\n') self.assertEqual(result, benchmark)
def test_outer_12_null_fill(self): files = [self.file1, self.file2] sep = ',' index = ['name'] how = ['outer'] parse_dates = False null_fill = ['age,100', 'height,200'] join_csv._join( self.outfile, files, sep, index, how, null_fill, parse_dates) result = self.outfile.getvalue() benchmark = ( 'name,age,height\ndaniel,2.0,200.0\nian,1.0,11.0\n' 'joe,100.0,22.0\n') self.assertEqual(result, benchmark)