- self.assertEqual(3, mocked_open.call_count)
- self.assertEqual(
- 4, mocked_get.call_count,
- 'Not enough calls to collections().get(): expected 4, got {!r}'.format(
+ # open() several times here to make sure we don't reach our
+ # quota of mocked_get.call_count dishonestly (e.g., the first
+ # open causes 5 mocked_get, and the rest cause none).
+ self.assertEqual(8, mocked_open.call_count)
+ self.assertGreaterEqual(
+ mocked_get.call_count, 8,
+ 'Not enough calls to collections().get(): expected 8, got {!r}'.format(