(core) Upgrade to latest versions of asttokens and wrapt

Summary:
Upgrades asttokens mainly because I suspected it would have helped with an error in a user's document (see https://grist.slack.com/archives/C0234CPPXPA/p1686145370484509) but we were unable to confirm that. Also adds a related test that I (wrongly) expected to have a similar problem before upgrading asttokens.

Upgrades wrapt for Python 3.11 support. Closes https://github.com/gristlabs/grist-core/issues/534.

Not upgrading the dependencies for Python 2 because pip is giving me errors when I try to install to the `thirdparty` folder. Both these upgrades are motivated by issues specific to Python 3 so this doesn't seem worth pursuing immediately.

Test Plan: Existing tests.

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D3973
This commit is contained in:
Alex Hall 2023-07-26 18:50:36 +02:00
parent 3f71c9c488
commit ba16d50080
2 changed files with 21 additions and 2 deletions

View File

@ -1,4 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import unittest
import codebuilder import codebuilder
import six import six
import test_engine import test_engine
@ -195,6 +197,23 @@ return rec
self.assertEqual(type(make_body("foo")), six.text_type) self.assertEqual(type(make_body("foo")), six.text_type)
self.assertEqual(type(make_body(u"foo")), six.text_type) self.assertEqual(type(make_body(u"foo")), six.text_type)
@unittest.skipUnless(six.PY3, "Only Python 3 supports non-ascii variable names")
def test_make_formula_body_unicode_token_bug(self):
# Python < 3.12 has a bug in tokenizing certain unicode characters in variable names.
# This was worked around in https://github.com/gristlabs/asttokens/pull/82
# Surprisingly this test passes either way, but keeping it as a potentially tricky case.
self.assertEqual(
make_body(
"℘℘··℘℘2=℘℘··℘℘2($foo+℘℘··℘℘2*℘℘··℘℘2+$bar)\n"
"℘℘··℘℘2=1+a℘℘··℘℘b+a℘℘··℘℘2b\n"
"℘℘··℘℘2==℘℘··℘℘2($foo+℘℘··℘℘2*℘℘··℘℘2+$bar)"
),
(
"℘℘··℘℘2=℘℘··℘℘2(rec.foo+℘℘··℘℘2*℘℘··℘℘2+rec.bar)\n"
"℘℘··℘℘2=1+a℘℘··℘℘b+a℘℘··℘℘2b\n"
"return ℘℘··℘℘2==℘℘··℘℘2(rec.foo+℘℘··℘℘2*℘℘··℘℘2+rec.bar)"
),
)
def test_wrap_logical(self): def test_wrap_logical(self):
self.assertEqual(make_body("IF($foo, $bar, $baz)"), self.assertEqual(make_body("IF($foo, $bar, $baz)"),

View File

@ -6,7 +6,7 @@
# #
astroid==2.14.2 astroid==2.14.2
# via -r core/sandbox/requirements3.in # via -r core/sandbox/requirements3.in
asttokens==2.0.5 asttokens==2.2.1
# via # via
# friendly-traceback # friendly-traceback
# stack-data # stack-data
@ -51,5 +51,5 @@ typing-extensions==4.4.0
# via astroid # via astroid
unittest-xml-reporting==2.0.0 unittest-xml-reporting==2.0.0
# via -r core/sandbox/requirements3.in # via -r core/sandbox/requirements3.in
wrapt==1.12.1 wrapt==1.15.0
# via astroid # via astroid