def test_Cleanup(self):
        # test case
        # test if show_nulls() can handle an integer input
        self.assertEqual(cu.show_nulls(123), None)

        #test if show_nulls() can handle a string input
        self.assertEqual(cu.show_nulls('abc'), None)

        #test if show_nulls() can handle a list input
        self.assertEqual(cu.show_nulls([123, 'abc']), None)

        #test if the None values are changed to NaN
        cu.show_nulls(self.testdf)
        for item in self.testdf:
            self.assertIsNot(item, None)

        #test if show_nulls() returns a matplotlib.axes.Axes object
        obj = cu.show_nulls(self.testdf)
        self.assertIsInstance(obj, matplotlib.axes.Axes)
Ejemplo n.º 2
0
import xuebadb.dbgeneric.db_interface as dbintfc
import xuebadb.dfanalysis.cleanup as cleanup
import xuebadb.dfanalysis.stats as stats
import testsuite

# Testing out connectivity to a MySQL DB server using the package
res_con = dbintfc.DBInterface('mysql', 'cosc304.ok.ubc.ca', 'vbalaji', '10796456', 'WorksOn')
res_df = res_con.querySelect("select * from dept")
cleanup.show_nulls(res_df)
print(res_df)
print(stats.dfSummary(res_df))

# Testing out connectivity to a SQL server DB using the package
res_con = dbintfc.DBInterface('sql_server', 'sql04.ok.ubc.ca', 'rlawrenc', 'test', 'workson')
res_df = res_con.querySelect("select * from emp")
cleanup.show_nulls(res_df)
print(res_df)
stats.colBoxPlot(res_df)

# Running the xuebadb package test-suite
testsuite.testSuite()