def test_sql_result_set(self): r = SQLAResult(self.person, self.fields) r['dummy'] = 5 self.assertTrue('dummy' in r.keys()) self.assertEqual(len(r), len(self.fields)) self.assertEqual(r['dummy'], 5)
def test_sql_result_keys(self): r = SQLAResult(self.person, self.fields) self.assertEqual(r.keys(), self.fields) self.assertEqual(len(r), len(self.fields)) self.assertTrue('prog' in r.keys())
def test_sql_result_get(self): r = SQLAResult(self.person, self.fields) self.assertEqual(r['firstname'], 'douglas') self.assertRaises(KeyError, lambda r: r['shouldNotExist'], r)