def setUp(self): self.schema = {'_id': {'type': 'integer'}, 'test': {'type': 'string'}} g = Mock() g.node = Mock(side_effect=lambda i: fake_node(id=i)) g.relationship = Mock(side_effect=lambda i: fake_relationship()) g.match = Mock( side_effect=lambda o, l, t, limit: (fake_relationship() for _ in range(limit and min(4, limit) or 4))) g.create = Mock(side_effect=lambda *r: r) self.g = g