Exemplo n.º 1
0
 def test_returns_false_if_not_all_files_are_opened(self):
     with create_mock_can_open() as can_open:
         can_open.return_value = False
         self.assertFalse(utils.can_open_all([
             "/some/path/a",
             "/some/path/b",
         ]))
Exemplo n.º 2
0
 def test_returns_false_if_not_all_files_are_opened(self):
     with create_mock_can_open() as can_open:
         can_open.return_value = False
         self.assertFalse(utils.can_open_all([
             "/some/path/a",
             "/some/path/b",
         ]))
Exemplo n.º 3
0
 def test_returns_true_if_all_files_are_openable(self):
     with create_mock_can_open():
         self.assertTrue(
             utils.can_open_all([
                 "/some/path/a",
                 "/some/path/b",
             ]))
Exemplo n.º 4
0
 def test_only_call_can_open_as_many_times_as_needed(self):
     with create_mock_can_open() as can_open:
         can_open.side_effect = [True, False, True]
         self.assertFalse(utils.can_open_all([
             "/can/open",
             "/cannot/open",
             "/can/open",
         ]))
     self.assertEqual(can_open.call_count, 2)
Exemplo n.º 5
0
 def test_only_call_can_open_as_many_times_as_needed(self):
     with create_mock_can_open() as can_open:
         can_open.side_effect = [True, False, True]
         self.assertFalse(utils.can_open_all([
             "/can/open",
             "/cannot/open",
             "/can/open",
         ]))
     self.assertEqual(can_open.call_count, 2)
Exemplo n.º 6
0
 def test_returns_true_if_all_files_are_openable(self):
     with create_mock_can_open():
         self.assertTrue(utils.can_open_all(["/some/path/a", "/some/path/b"]))