From 8af98f0ab0e44c7b6124f0cf4fd560c751cbbf9c Mon Sep 17 00:00:00 2001 From: Henddher Pedroza Date: Sun, 13 Oct 2019 18:13:31 -0400 Subject: [PATCH] TestBatchCommandProcessor with incorrect #INSERT --- evennia/utils/tests/test_batchprocessors.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/evennia/utils/tests/test_batchprocessors.py b/evennia/utils/tests/test_batchprocessors.py index 8edfaf7ba9..d89f54fe0f 100644 --- a/evennia/utils/tests/test_batchprocessors.py +++ b/evennia/utils/tests/test_batchprocessors.py @@ -67,3 +67,22 @@ class TestBatchCommandProcessor(TestCase): mock.call('foopath', file_ending='.ev'), mock.call('another.ev', file_ending='.ev')]) + @mock.patch.object(batchprocessors, 'read_batchfile') + def test_parses_INSERT_raises_IOError(self, mocked_read): + mocked_read.side_effect = [ + textwrap.dedent(r""" + @create sky + # + #INSERT x + # + @create sun + # + """), + IOError + ] + with self.assertRaises(IOError, msg='#INSERT x failed.'): + commands = batchprocessors.BATCHCMD.parse_file('foopath') + self.assertEqual(mocked_read.mock_calls, [ + mock.call('foopath', file_ending='.ev'), + mock.call('x', file_ending='.ev')]) +