コード例 #1
0
ファイル: test_logic.py プロジェクト: HexaCubist/ontask_b
    def test_df_equivalent_after_sql(self):

        # Parse the CSV
        df_source = pandas_db.load_df_from_csvfile(
            StringIO.StringIO(self.csv1), 0, 0)

        # Store the DF in the DB
        pandas_db.store_table(df_source, self.table_name)

        # Load it from the DB
        df_dst = pandas_db.load_table(self.table_name)

        # Data frames mut be identical
        assert df_source.equals(df_dst)
コード例 #2
0
    def df_equivalent_after_sql(self):

        # Parse the CSV
        df_source = pandas_db.load_df_from_csvfile(
            StringIO.StringIO(self.csv1), 0, 0)

        # Store the DF in the DB
        pandas_db.store_table(df_source, self.table_name)

        # Load it from the DB
        df_dst = pandas_db.load_table(self.table_name)

        # Columns have to have the same values (None and NaN are
        # different)
        for x in df_source.columns:
            np.testing.assert_array_equal(
                np.array(df_source[x], dtype=unicode),
                np.array(df_dst[x], dtype=unicode))
コード例 #3
0
def load_upload_from_db(pk):
    return load_table(create_upload_table_name(pk))