def test_expectations_with_multiple_return_values(self):
        db = Fake("db").expects("get_id").returns(1).expects("set_id").next_call(for_method="get_id").returns(2)
        eq_(db.get_id(), 1)
        eq_(db.set_id(), None)
        eq_(db.get_id(), 2)

        fudge.verify()
示例#2
0
 def test_returns(self):
     db = Fake("db")\
         .provides("get_id").returns(1)\
         .provides("set_id")\
         .next_call(for_method="get_id").returns(2)
     # print [c.return_val for c in db._declared_calls["get_id"]._calls]
     eq_(db.get_id(), 1)
     eq_(db.set_id(), None)
     eq_(db.get_id(), 2)
示例#3
0
 def test_too_many_calls(self):
     db = Fake("db")\
         .remember_order()\
         .expects("get_id").returns(1)\
         .expects("set_id")
     eq_(db.get_id(), 1)
     eq_(db.set_id(), None)
     # extra :
     eq_(db.get_id(), 1)
示例#4
0
 def test_returns(self):
     db = Fake("db")\
         .provides("get_id").returns(1)\
         .provides("set_id")\
         .next_call(for_method="get_id").returns(2)
     # print [c.return_val for c in db._declared_calls["get_id"]._calls]
     eq_(db.get_id(), 1)
     eq_(db.set_id(), None)
     eq_(db.get_id(), 2)
示例#5
0
 def test_too_many_calls(self):
     db = Fake("db")\
         .remember_order()\
         .expects("get_id").returns(1)\
         .expects("set_id")
     eq_(db.get_id(), 1)
     eq_(db.set_id(), None)
     # extra :
     eq_(db.get_id(), 1)
示例#6
0
 def test_multiple_returns_affect_order(self):
     db = Fake("db")\
         .remember_order()\
         .expects("get_id").returns(1)\
         .expects("set_id")\
         .next_call(for_method="get_id").returns(2)
     eq_(db.get_id(), 1)
     eq_(db.set_id(), None)
     eq_(db.get_id(), 2)
     fudge.verify()
示例#7
0
    def test_expectations_with_multiple_return_values(self):
        db = Fake("db")\
            .expects("get_id").returns(1)\
            .expects("set_id")\
            .next_call(for_method="get_id").returns(2)
        eq_(db.get_id(), 1)
        eq_(db.set_id(), None)
        eq_(db.get_id(), 2)

        fudge.verify()
示例#8
0
 def test_multiple_returns_affect_order(self):
     db = Fake("db")\
         .remember_order()\
         .expects("get_id").returns(1)\
         .expects("set_id")\
         .next_call(for_method="get_id").returns(2)
     eq_(db.get_id(), 1)
     eq_(db.set_id(), None)
     eq_(db.get_id(), 2)
     fudge.verify()