def check(): table = self.i.t.sasync_items for name, inserted in items.iteritems(): value = table.select( and_(table.c.group_id == 123, table.c.name == name)).execute().fetchone()['value'] msg = "Inserted '{}:{}' ".format(name, inserted) +\ "but read '{}' back from the database!".format(value) self.failUnlessEqual(value, inserted, msg) for otherName, otherValue in items.iteritems(): if otherName != name and value == otherValue: self.fail( "Inserted item '%s' is equal to item '%s'" % \ (name, otherName))
def check(): table = self.i.t.sasync_items for name, inserted in items.iteritems(): value = ( table.select(and_(table.c.group_id == 123, table.c.name == name)).execute().fetchone()["value"] ) self.failUnlessEqual( value, inserted, "Inserted '%s:%s' but read '%s' back from the database!" % (name, inserted, value), ) for otherName, otherValue in items.iteritems(): if otherName != name and value == otherValue: self.fail("Inserted item '%s' is equal to item '%s'" % (name, otherName))
def check(): table = self.i.t.sasync_items for name, inserted in items.iteritems(): value = table.select( and_(table.c.group_id == 123, table.c.name == name) ).execute().fetchone()['value'] msg = "Inserted '{}:{}' ".format(name, inserted) +\ "but read '{}' back from the database!".format(value) self.failUnlessEqual(value, inserted, msg) for otherName, otherValue in items.iteritems(): if otherName != name and value == otherValue: self.fail( "Inserted item '%s' is equal to item '%s'" % \ (name, otherName))
def test_insertAndLoadAll(self): items = {'a':0, 'b':1, 'c':2, 'd':3, 'e':4} def first(null): return self.i.loadAll().addCallback(second) def second(loadedItems): self.failUnlessEqual(loadedItems, items) dL = [] for name, value in items.iteritems(): dL.append(self.i.insert(name, value)) return DeferredList(dL).addCallback(first)
def testInsertAndLoadAll(self): items = {'a':0, 'b':1, 'c':2, 'd':3, 'e':4} def first(null): return self.i.loadAll().addCallback(second) def second(loadedItems): self.failUnlessEqual(loadedItems, items) dL = [] for name, value in items.iteritems(): dL.append(self.i.insert(name, value)) return DeferredList(dL).addCallback(first)
def testInsertAndLoadAll(self): items = {"a": 0, "b": 1, "c": 2, "d": 3, "e": 4} def first(null): return self.i.loadAll().addCallback(second) def second(loadedItems): self.failUnlessEqual(loadedItems, items) dL = [] for name, value in items.iteritems(): dL.append(self.i.insert(name, value)) return DeferredList(dL).addCallback(first)
def test_insertAndUpdate(self): items = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4} def first(null): return self.i.update('b', 10).addCallback(second) def second(null): return self.i.loadAll().addCallback(third) def third(loadedItems): expectedItems = {'a': 0, 'b': 10, 'c': 2, 'd': 3, 'e': 4} self.failUnlessEqual(loadedItems, expectedItems) dL = [] for name, value in items.iteritems(): dL.append(self.i.insert(name, value)) return DeferredList(dL).addCallback(first)
def test_insertAndDelete(self): items = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4} def first(null): return self.i.delete('c').addCallback(second) def second(null): return self.i.names().addCallback(third) def third(nameList): desiredList = [x for x in items.keys() if x != 'c'] desiredList.sort() nameList.sort() self.failUnlessEqual(nameList, desiredList) dL = [] for name, value in items.iteritems(): dL.append(self.i.insert(name, value)) return DeferredList(dL).addCallback(first)
def test_insertAndDelete(self): items = {'a':0, 'b':1, 'c':2, 'd':3, 'e':4} def first(null): return self.i.delete('c').addCallback(second) def second(null): return self.i.names().addCallback(third) def third(nameList): desiredList = [x for x in items.keys() if x != 'c'] desiredList.sort() nameList.sort() self.failUnlessEqual(nameList, desiredList) dL = [] for name, value in items.iteritems(): dL.append(self.i.insert(name, value)) return DeferredList(dL).addCallback(first)
def testInsertAndDelete(self): items = {"a": 0, "b": 1, "c": 2, "d": 3, "e": 4} def first(null): return self.i.delete("c").addCallback(second) def second(null): return self.i.names().addCallback(third) def third(nameList): desiredList = [x for x in items.keys() if x != "c"] desiredList.sort() nameList.sort() self.failUnlessEqual(nameList, desiredList) dL = [] for name, value in items.iteritems(): dL.append(self.i.insert(name, value)) return DeferredList(dL).addCallback(first)