def test_write_failure(self, m_dump): m_dump.side_effect = SerializerError obj = FileObject(random_string()) self.assertRaises(FileObjectError, obj.write, random_string())
def test_write_success(cls, _): obj = FileObjectError(random_string()) obj = FileObject(random_string()) obj.write(random_string())
def test_read_success(self, m_load): m_load.return_value = random_string() obj = FileObject(random_string()) result = obj.read() self.assertEqual(m_load.return_value, result)
def test_read_failure(self, m_load): m_load.side_effect = SerializerError obj = FileObject(random_string()) self.assertRaises(FileObjectError, obj.read)