Пример #1
0
 def test_write_failure(self, m_dump):
     m_dump.side_effect = SerializerError
     obj = FileObject(random_string())
     self.assertRaises(FileObjectError, obj.write, random_string())
Пример #2
0
 def test_write_success(cls, _):
     obj = FileObjectError(random_string())
     obj = FileObject(random_string())
     obj.write(random_string())
Пример #3
0
 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)
Пример #4
0
 def test_read_failure(self, m_load):
     m_load.side_effect = SerializerError
     obj = FileObject(random_string())
     self.assertRaises(FileObjectError, obj.read)
Пример #5
0
 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)