def test_mysql_stream(self): for i, row in enumerate(mysql_stream(SELECT_LOCATIONS)): self.assertEqual(row.city, self.data_table[i].city) self.assertEqual(row.street, self.data_table[i].street) self.assertEqual(row.zip, self.data_table[i].zip) self.assertEqual(row.beds, int(self.data_table[i].beds)) self.assertEqual(row.baths, int(self.data_table[i].baths)) self.assertEqual(row.square_feet, int(self.data_table[i].square_feet)) self.assertEqual(row.appartment_type, self.data_table[i].appartment_type)
def test_no_results(self): x = list(mysql_stream(SELECT_NO_RESULTS)) self.assertFalse(x)
def test_invalid_sql(self): with self.assertRaises(Exception): list(mysql_stream('AAA'))