def test_temp_row_factory(self): """ Tests the temp_row_factory Context Manager works as advertised """ utils.setupconnection(self) row = self.connection.execute(" SELECT 1 AS myvalue;").fetchone() self.assertFalse(isinstance(row,dict)) self.assertEqual(row[0],1) with Utilities.temp_row_factory(self.connection, sql.dict_factory): row = self.connection.execute(" SELECT 1 AS myvalue;").fetchone() self.assertTrue(isinstance(row,dict)) self.assertEqual(row['myvalue'],1) row = self.connection.execute(" SELECT 1 AS myvalue;").fetchone() self.assertFalse(isinstance(row,dict)) self.assertEqual(row[0],1)
def test_uniquetableconstraint(self): """ Various tests for UniqueTableConstraints TODO """ utils.setupconnection(self) self.connection.execute(""" CREATE TABLE uniquetest ( a,b,c, UNIQUE (a,b,c) );""") table = self.connection.getadvancedtable("uniquetest") self.assertTrue(table) con = table.tableconstraints[0] ## Below is the current Equality test for Constraints and Table Constraints ## Be sure to check for updates when next needed #for attr in ["constraint","info","conflictclause"]: # with self.subTest(attr = attr, con = con): # self.assertEqual(getattr(con,attr),getattr(con,attr)) #for column in con.columns: # with self.subTest(column = column, con = con): # self.assertIn(column,con.columns) self.assertEqual(con,con)
def setUp(self): utils.setupconnection(self) utils.populatetesttable(self) return super().setUp()
def setUp(self): utils.setupconnection(self) utils.setupadvancedtables(self) return super().setUp()
def setUp(self): utils.setupconnection(self) utils.setupadvancedtables(self) self.maxDiff = None return super().setUp()
def setUp(self): utils.setupconnection(self) utils.setupadditionaltables(self) utils.populatealltables(self) return super().setUp()
def setUp(self): utils.setupconnection(self) utils.setupadvancedtables(self) self.samplerow = dict(commentid = 1,uid = 1, pid = 1, commenttime = "20160101T0001+0000", replyto = None, comment = "Thanks for reading, Everyone! It's my New Year's Resolution to write a post a day! Look forward to it!") return super().setUp()
def setUp(self): utils.setupconnection(self) return super().setUp()
def setUp(self): utils.setupconnection(self) self.tablecon = utils.gettesttableconstructor() return super().setUp()