Exemple #1
0
    def test_sequential(self):
        args = ['examples/join_a.csv', 'examples/join_b.csv']
        output_file = StringIO()

        utility = CSVJoin(args, output_file)
        utility.main()

        output = StringIO(output_file.getvalue())

        self.assertEqual(len(output.readlines()), 4)
Exemple #2
0
    def test_outer(self):
        args = ['-c', 'a', '--outer', 'examples/join_a.csv', 'examples/join_b.csv']
        output_file = six.StringIO()

        utility = CSVJoin(args, output_file)
        utility.main()

        output = six.StringIO(output_file.getvalue())

        self.assertEqual(len(output.readlines()), 6)
Exemple #3
0
    def test_inner(self):
        args = ['-c', 'a', 'examples/join_a.csv', 'examples/join_b.csv']
        output_file = six.StringIO()

        utility = CSVJoin(args, output_file)
        utility.main()

        output = six.StringIO(output_file.getvalue())

        self.assertEqual(len(output.readlines()), 3)
Exemple #4
0
    def test_left_short_columns(self):
        args = ['-c', 'a', 'examples/join_a_short.csv', 'examples/join_b.csv']
        output_file = six.StringIO()

        utility = CSVJoin(args, output_file)
        utility.main()

        output = six.StringIO(output_file.getvalue())

        with open('examples/join_short.csv') as f:
            self.assertEqual(output.readlines(), f.readlines())
Exemple #5
0
    def test_left_short_columns(self):
        args = ['-c', 'a', 'examples/join_a_short.csv', 'examples/join_b.csv']
        output_file = six.StringIO()

        utility = CSVJoin(args, output_file)
        utility.main()

        output = six.StringIO(output_file.getvalue())

        with open('examples/join_short.csv') as f:
            self.assertEqual(output.readlines(), f.readlines())