示例#1
0
 def test_call_count(self):
     s = Spy('str')
     s.upper()
     self.assertEqual(1, s.upper.call_count())
     s.lower()
     self.assertEqual(1, s.upper.call_count())
     s.upper()
     self.assertEqual(2, s.upper.call_count())
示例#2
0
 def test_all_calls_args_flatten(self):
     s = Spy('str')
     s.replace('t', 'T')
     s.upper()
     s.lower(1)
     self.assertEqual(['t', 'T', 1], s.all_calls_args_flatten())
示例#3
0
 def test_all_calls_args(self):
     s = Spy('str')
     s.replace('t', 'T')
     s.upper()
     s.lower(1)
     self.assertEqual([('t', 'T'), (), (1, )], s.all_calls_args())