def test_save(self): RejectionPattern("Something").save() RejectionPattern(u"人员", None).save() print RejectionPattern.findall() conn = self.connect_db() try: c = conn.cursor() c.execute("SELECT COUNT(*) FROM " + RejectionPattern.table_name) self.assertEqual(c.fetchone()[0], 2, "Count of rejection_pattern should be 2") except: pass finally: conn.close()
def test_save(self): RejectionPattern('Something').save() RejectionPattern(u'人员', None).save() print RejectionPattern.findall() conn = self.connect_db() try: c = conn.cursor() c.execute('SELECT COUNT(*) FROM ' + RejectionPattern.table_name) self.assertEqual(c.fetchone()[0], 2, 'Count of rejection_pattern should be 2') except: pass finally: conn.close()
def test_find_all(self): self.rejection_pattern.save() another_rejection_pattern = RejectionPattern("[a-z]+", u"人员") another_rejection_pattern.save() records = RejectionPattern.findall() print "rejection_pattern", records self.assertEqual(2, len(records))
def test_find_all(self): self.rejection_pattern.save() another_rejection_pattern = RejectionPattern('[a-z]+', u'人员') another_rejection_pattern.save() records = RejectionPattern.findall() print 'rejection_pattern', records self.assertEqual(2, len(records))