mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Raise syntax errors that Python can format nicely to show the location
Summary: Update _create_syntax_error_code to raise an error with similar arguments to the real arguments it already has, with our modifications. Test Plan: Updated python unit tests Reviewers: jarek, dsagal Reviewed By: dsagal Subscribers: dsagal Differential Revision: https://phab.getgrist.com/D3040
This commit is contained in:
@@ -4,6 +4,7 @@ import unittest
|
||||
import difflib
|
||||
import re
|
||||
|
||||
import six
|
||||
from six.moves import xrange
|
||||
|
||||
import gencode
|
||||
@@ -69,6 +70,11 @@ class TestGenCode(unittest.TestCase):
|
||||
gcode = gencode.GenCode()
|
||||
gcode.make_module(self.schema)
|
||||
generated = gcode.get_user_text()
|
||||
if six.PY3:
|
||||
generated = generated.replace(
|
||||
", 'for a in b'))",
|
||||
", u'for a in b'))",
|
||||
)
|
||||
self.assertEqual(generated, saved_sample, "Generated code doesn't match sample:\n" +
|
||||
"".join(difflib.unified_diff(generated.splitlines(True),
|
||||
saved_sample.splitlines(True),
|
||||
|
||||
Reference in New Issue
Block a user