(core) updates from grist-core

This commit is contained in:
Paul Fitzpatrick 2023-09-12 14:16:02 -04:00
commit f659f3655d
4 changed files with 16 additions and 5 deletions

View File

@ -314,10 +314,17 @@ export class LinkingState extends Disposable {
return EmptyFilterState; return EmptyFilterState;
} }
if (this._srcSection.isDisposed()) {
//happened transiently in test: "RawData should remove all tables except one (...)"
console.warn("LinkingState._makeFilterObs: srcSectionDisposed");
return EmptyFilterState;
}
//Get selector-rowId //Get selector-rowId
const srcRowId = this._srcSection.activeRowId(); const srcRowId = this._srcSection.activeRowId();
if (srcRowId === null) { if (srcRowId === null) {
console.warn("_makeFilterObs activeRowId is null"); console.warn("LinkingState._makeFilterObs activeRowId is null");
return EmptyFilterState; return EmptyFilterState;
} }

View File

@ -1,8 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import unittest import unittest
import codebuilder
import six import six
from asttokens.util import fstring_positions_work
import codebuilder
import test_engine import test_engine
unicode_prefix = 'u' if six.PY2 else '' unicode_prefix = 'u' if six.PY2 else ''
@ -72,7 +74,7 @@ class TestCodeBuilder(test_engine.EngineTestCase):
self.assertEqual(make_body("'''test1'''\n\"\"\"test2\"\"\""), self.assertEqual(make_body("'''test1'''\n\"\"\"test2\"\"\""),
"'''test1'''\nreturn \"\"\"test2\"\"\"") "'''test1'''\nreturn \"\"\"test2\"\"\"")
if six.PY3: if fstring_positions_work():
self.assertEqual( self.assertEqual(
make_body("f'{$foo + 1 + $bar} 2 {3 + $baz}' + $foo2 + f'{4 + $bar2}!'"), make_body("f'{$foo + 1 + $bar} 2 {3 + $baz}' + $foo2 + f'{4 + $bar2}!'"),
"return f'{rec.foo + 1 + rec.bar} 2 {3 + rec.baz}' + rec.foo2 + f'{4 + rec.bar2}!'" "return f'{rec.foo + 1 + rec.bar} 2 {3 + rec.baz}' + rec.foo2 + f'{4 + rec.bar2}!'"

View File

@ -1,5 +1,6 @@
import unittest import unittest
import six import six
from asttokens.util import fstring_positions_work
import test_engine import test_engine
import testutil import testutil
@ -219,6 +220,7 @@ class Table3:
def reflist(rec: Table3) -> list[Table2]: def reflist(rec: Table3) -> list[Table2]:
''') ''')
@unittest.skipUnless(fstring_positions_work(), "Needs Python 3.10+")
def test_convert_completion(self): def test_convert_completion(self):
completion = """ completion = """
Here's some code: Here's some code:

View File

@ -2,7 +2,7 @@
import logging import logging
import unittest import unittest
import six from asttokens.util import fstring_positions_work
import testutil import testutil
import test_engine import test_engine
@ -81,7 +81,7 @@ class TestRenames(test_engine.EngineTestCase):
}] }]
]}) ]})
@unittest.skipUnless(six.PY3, "Python 3 only") @unittest.skipUnless(fstring_positions_work(), "Python 3.10+ only")
def test_rename_inside_fstring(self): def test_rename_inside_fstring(self):
self.load_sample(self.sample) self.load_sample(self.sample)
self.add_column("People", "CityUpper", formula="f'{$city.upper()}'") self.add_column("People", "CityUpper", formula="f'{$city.upper()}'")