Beispiel #1
0
 def test_ioerror(self):
     file_obj = mock.Mock()
     file_obj.tell.side_effect = IOError
     self.assertIsNone(file_proxy.get_file_size(file_obj))
Beispiel #2
0
 def test_size(self):
     file_obj = mock.Mock()
     file_obj.tell.side_effect = (0, 10)
     self.assertEqual(10, file_proxy.get_file_size(file_obj))
     self.assertEqual([mock.call(0, os.SEEK_END),
                       mock.call(0)], file_obj.seek.mock_calls)
Beispiel #3
0
 def test_none(self):
     self.assertIsNone(file_proxy.get_file_size('fake_file_obj'))
 def test_ioerror(self):
     file_obj = mock.Mock()
     file_obj.tell.side_effect = IOError
     self.assertIsNone(file_proxy.get_file_size(file_obj))
 def test_size(self):
     file_obj = mock.Mock()
     file_obj.tell.side_effect = (0, 10)
     self.assertEqual(10, file_proxy.get_file_size(file_obj))
     self.assertEqual([mock.call(0, os.SEEK_END), mock.call(0)],
                      file_obj.seek.mock_calls)
 def test_none(self):
     self.assertIsNone(file_proxy.get_file_size('fake_file_obj'))