コード例 #1
0
ファイル: test_table.py プロジェクト: KillEdision/agate
    def test_to_csv_to_stdout(self):
        table = Table(self.rows, self.columns)

        output = StringIO()
        table.to_csv(output)

        contents1 = output.getvalue()

        with open('examples/test.csv') as f:
            contents2 = f.read()

        self.assertEqual(contents1, contents2)
コード例 #2
0
ファイル: test_table.py プロジェクト: themuniz/agate
    def test_to_csv_to_stdout(self):
        table = Table(self.rows, self.column_names, self.column_types)

        output = StringIO()
        table.to_csv(output)

        contents1 = output.getvalue()

        with open('examples/test.csv') as f:
            contents2 = f.read()

        self.assertEqual(contents1, contents2)
コード例 #3
0
ファイル: test_table.py プロジェクト: themuniz/agate
    def test_to_csv(self):
        table = Table(self.rows, self.column_names, self.column_types)

        table.to_csv('.test.csv')

        with open('.test.csv') as f:
            contents1 = f.read()

        with open('examples/test.csv') as f:
            contents2 = f.read()

        self.assertEqual(contents1, contents2)

        os.remove('.test.csv')
コード例 #4
0
ファイル: test_table.py プロジェクト: KillEdision/agate
    def test_to_csv(self):
        table = Table(self.rows, self.columns)

        table.to_csv('.test.csv')

        with open('.test.csv') as f:
            contents1 = f.read()

        with open('examples/test.csv') as f:
            contents2 = f.read()

        self.assertEqual(contents1, contents2)

        os.remove('.test.csv')
コード例 #5
0
    def test_to_csv_make_dir(self):
        table = Table(self.rows, self.column_names, self.column_types)

        table.to_csv('newdir/test.csv')

        with open('newdir/test.csv') as f:
            contents1 = f.read()

        with open('examples/test.csv') as f:
            contents2 = f.read()

        self.assertEqual(contents1, contents2)

        os.remove('newdir/test.csv')
        os.rmdir('newdir/')
コード例 #6
0
ファイル: test_table.py プロジェクト: themuniz/agate
    def test_to_csv_file_like_object(self):
        table = Table(self.rows, self.column_names, self.column_types)

        with open('.test.csv', 'w') as f:
            table.to_csv(f)

            # Should leave the file open
            self.assertFalse(f.closed)

        with open('.test.csv') as f:
            contents1 = f.read()

        with open('examples/test.csv') as f:
            contents2 = f.read()

        self.assertEqual(contents1, contents2)

        os.remove('.test.csv')
コード例 #7
0
ファイル: test_table.py プロジェクト: KillEdision/agate
    def test_to_csv_file_like_object(self):
        table = Table(self.rows, self.columns)

        with open('.test.csv', 'w') as f:
            table.to_csv(f)

            # Should leave the file open
            self.assertFalse(f.closed)

        with open('.test.csv') as f:
            contents1 = f.read()

        with open('examples/test.csv') as f:
            contents2 = f.read()

        self.assertEqual(contents1, contents2)

        os.remove('.test.csv')