mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Attempt to fix test_formula_prompt test broken by a merge
Test Plan: Tests should pass Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D3797
This commit is contained in:
parent
ddde364e5d
commit
d70a7209f7
@ -8,18 +8,26 @@ from formula_prompt import (
|
||||
values_type, column_type, referenced_tables, get_formula_prompt,
|
||||
)
|
||||
from objtypes import RaisedException
|
||||
from records import Record, RecordSet
|
||||
from records import Record as BaseRecord, RecordSet as BaseRecordSet
|
||||
|
||||
|
||||
class FakeTable(object):
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
class Record(BaseRecord):
|
||||
_table = self
|
||||
class RecordSet(BaseRecordSet):
|
||||
_table = self
|
||||
self.Record = Record
|
||||
self.RecordSet = RecordSet
|
||||
|
||||
table_id = "Table1"
|
||||
_identity_relation = None
|
||||
|
||||
|
||||
fake_table = FakeTable()
|
||||
|
||||
|
||||
@unittest.skipUnless(six.PY3, "Python 3 only")
|
||||
class TestFormulaPrompt(test_engine.EngineTestCase):
|
||||
def test_values_type(self):
|
||||
@ -38,22 +46,22 @@ class TestFormulaPrompt(test_engine.EngineTestCase):
|
||||
self.assertEqual(values_type([1, 2, "3", None]), "Any")
|
||||
|
||||
self.assertEqual(values_type([
|
||||
Record(FakeTable(), None),
|
||||
Record(FakeTable(), None),
|
||||
fake_table.Record(None),
|
||||
fake_table.Record(None),
|
||||
]), "Table1")
|
||||
self.assertEqual(values_type([
|
||||
Record(FakeTable(), None),
|
||||
Record(FakeTable(), None),
|
||||
fake_table.Record(None),
|
||||
fake_table.Record(None),
|
||||
None,
|
||||
]), "Optional[Table1]")
|
||||
|
||||
self.assertEqual(values_type([
|
||||
RecordSet(FakeTable(), None),
|
||||
RecordSet(FakeTable(), None),
|
||||
fake_table.RecordSet(None),
|
||||
fake_table.RecordSet(None),
|
||||
]), "List[Table1]")
|
||||
self.assertEqual(values_type([
|
||||
RecordSet(FakeTable(), None),
|
||||
RecordSet(FakeTable(), None),
|
||||
fake_table.RecordSet(None),
|
||||
fake_table.RecordSet(None),
|
||||
None,
|
||||
]), "Optional[List[Table1]]")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user