Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit

Permalink
make changes in test
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabhsingh1608 committed Jul 2, 2024
1 parent 5e03089 commit 679dd02
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 21 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file added src/.DS_Store
Binary file not shown.
19 changes: 9 additions & 10 deletions src/thoughtspot_tml/tml.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,15 @@ class Worksheet(_tml.TML):
def name(self) -> str:
return self.worksheet.name

# we are now handling this in another class "Model"
# @property
# def is_model(self) -> bool:
# """
# Determines if the TML object is the newer Worksheet, a Model.

# Further reading:
# https://docs.thoughtspot.com/cloud/latest/models
# """
# return self.worksheet.schema is not None
@property
def is_model(self) -> bool:
"""
Determines if the TML object is the newer Worksheet, a Model.
Further reading:
https://docs.thoughtspot.com/cloud/latest/models
"""
return self.worksheet.schema is not None

@classmethod
def _loads(cls, tml_document: str) -> Dict[str, Any]:
Expand Down
1 change: 1 addition & 0 deletions tests/_const.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
DUMMY_PINBOARD = DATA_DIR / "DUMMY.pinboard.tml"
DUMMY_LIVEBOARD = DATA_DIR / "DUMMY.liveboard.tml"
DUMMY_SPOTAPP = DATA_DIR / "DUMMY_spot_app.zip"
DUMMY_MODEL_GA = DATA_DIR / "DUMMY.model.tml"
16 changes: 5 additions & 11 deletions tests/test_model.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
from thoughtspot_tml import Model
from ward import test # type: ignore
from ward import test

from . import _const


for version, file in ("V2", _const.DUMMY_MODEL):
for file in ( _const.DUMMY_MODEL_GA, ):

@test("Worksheet {version} deep attribute access")
def _(file=file, version=version):
@test("Model deep attribute access")
def _(file=file):
t = Model.load(file)

assert type(t) is Model

t.guid
t.model
t.model.formulas
t.model.formulas[0].expr
t.model.columns
t.model.columns[0].properties
t.model.columns[0].properties.column_type
t.model.columns[0].properties.index_type
t.model.properties
t.model.properties.is_bypass_rls
t.model.model_tables


if version == "V2":
assert t.is_model is True
t.model.schema
t.model.schema.model_tables
t.model.schema.model_tables[0].name
t.model.schema.model_tables[0].alias

0 comments on commit 679dd02

Please sign in to comment.