File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,24 @@ def list_formats(path: Optional[Path] = None) -> list[str]:
7272 if fmt .is_dir () and fmt .name != 'utils'
7373 ]
7474
75+ @staticmethod
76+ def list_versions (fmt : str , path : Optional [Path ] = None ) -> list [str ]:
77+ """Return supported version of specific format with list of version
78+ string value.
79+
80+ Arges:
81+ path (Path | None): A template path that want to search.
82+
83+ :rtype: list[str]
84+ """
85+ if path is None :
86+ path : Path = Path ('./templates' )
87+ return [
88+ f .name
89+ for f in (path / fmt ).glob (pattern = '*' )
90+ if f .is_dir ()
91+ ]
92+
7593 @classmethod
7694 def format (cls , name : str , path : Optional [Path ] = None ) -> 'SQLPlate' :
7795 """Construction this class from a system value name.
Original file line number Diff line number Diff line change @@ -27,6 +27,15 @@ def test_sqlplate_version(template_path):
2727 fmt .version ("latest" )
2828
2929
30+ def test_sqlplate_versions (template_path ):
31+ versions : list [str ] = SQLPlate .list_versions (
32+ fmt = "databricks" , path = template_path
33+ )
34+ assert isinstance (versions , list )
35+ assert len (versions ) > 0
36+ assert 'latest' in versions
37+
38+
3039def test_sqlplate_check (template_path ):
3140 fmt : SQLPlate = SQLPlate .format ("databricks" , path = template_path )
3241
You can’t perform that action at this time.
0 commit comments