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'))