Skip to content

Commit 34cbb04

Browse files
committed
csv parser now gets format column
1 parent c894038 commit 34cbb04

File tree

6 files changed

+345
-85
lines changed

6 files changed

+345
-85
lines changed

synapseclient/extensions/curator/schema_generation.py

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,27 @@ class ListColumnType(ColumnType):
114114
]
115115

116116

117+
class Format(Enum):
118+
"""
119+
Allowed formats by the JSON Schema validator used by Synapse: https://github.com/everit-org/json-schema#format-validators
120+
For descriptions see: https://json-schema.org/understanding-json-schema/reference/type#format
121+
"""
122+
123+
DATE_TIME = "date-time"
124+
EMAIL = "email"
125+
HOSTNAME = "hostname"
126+
IPV4 = "ipv4"
127+
IPV6 = "ipv6"
128+
URI = "uri"
129+
URI_REFERENCE = "uri-reference"
130+
URI_TEMPLATE = "uri-template"
131+
JSON_POINTER = "json-pointer"
132+
DATE = "date"
133+
TIME = "time"
134+
REGEX = "regex"
135+
RELATIVE_JSON_POINTER = "relative-json-pointer"
136+
137+
117138
# Translates list types to their atomic type
118139
LIST_TYPE_DICT = {
119140
ListColumnType.STRING_LIST: AtomicColumnType.STRING,
@@ -636,6 +657,7 @@ def gather_csv_attributes_relationships(
636657
# get attributes from Attribute column
637658
attributes = model_df.to_dict("records")
638659
model_includes_column_type = "columnType" in model_df.columns
660+
model_includes_format = "Format" in model_df.columns
639661

640662
# Build attribute/relationship dictionary
641663
relationship_types = self.required_headers
@@ -659,6 +681,9 @@ def gather_csv_attributes_relationships(
659681
attr_rel_dictionary[attribute_name]["Relationships"].update(
660682
column_type_dict
661683
)
684+
if model_includes_format:
685+
format_dict = self.parse_format(attr)
686+
attr_rel_dictionary[attribute_name]["Relationships"].update(format_dict)
662687
return attr_rel_dictionary
663688

664689
def parse_column_type(self, attr: dict) -> dict:
@@ -691,6 +716,34 @@ def parse_column_type(self, attr: dict) -> dict:
691716

692717
return {"ColumnType": column_type}
693718

719+
def parse_format(self, attr: dict) -> dict[str, str]:
720+
"""Parse the format for a given attribute.
721+
722+
Args:
723+
attr: The attribute dictionary.
724+
725+
Returns:
726+
A dictionary containing the parsed column type information if present
727+
else an empty dict
728+
"""
729+
from pandas import isna
730+
731+
format_value = attr.get("Format")
732+
733+
if isna(format_value):
734+
return {}
735+
736+
format_string = str(format_value).strip().lower()
737+
738+
check_allowed_values(
739+
self.dmr,
740+
entry_id=attr["Format"],
741+
value=format_string,
742+
relationship="format",
743+
)
744+
745+
return {"Format": format_string}
746+
694747
def parse_csv_model(
695748
self,
696749
path_to_data_model: str,
@@ -1708,6 +1761,37 @@ def get_node_column_type(
17081761
raise ValueError(msg)
17091762
return column_type
17101763

1764+
def get_node_format(
1765+
self, node_label: Optional[str] = None, node_display_name: Optional[str] = None
1766+
) -> Optional[ColumnType]:
1767+
"""Gets the format of the node
1768+
1769+
Args:
1770+
node_label: The label of the node to get the format from
1771+
node_display_name: The display name of the node to get the format from
1772+
1773+
Raises:
1774+
ValueError: If the value from the node is not allowed
1775+
1776+
Returns:
1777+
The format of the node if it has one, otherwise None
1778+
"""
1779+
node_label = self._get_node_label(node_label, node_display_name)
1780+
rel_node_label = self.dmr.get_relationship_value("format", "node_label")
1781+
format_value = self.graph.nodes[node_label][rel_node_label]
1782+
if format_value is None:
1783+
return format_value
1784+
format_string = str(format_value).lower()
1785+
try:
1786+
column_type = Format(format_string)
1787+
except ValueError as exc:
1788+
msg = (
1789+
f"Node: '{node_label}' had illegal format value: '{format_value}'. "
1790+
f"Allowed values are: [{[member.value for member in Format]}]"
1791+
)
1792+
raise ValueError(msg) from exc
1793+
return column_type
1794+
17111795
def _get_node_label(
17121796
self, node_label: Optional[str] = None, node_display_name: Optional[str] = None
17131797
) -> str:
@@ -2826,6 +2910,16 @@ def define_data_model_relationships(self) -> dict:
28262910
"node_attr_dict": {"default": None},
28272911
"allowed_values": ALL_COLUMN_TYPE_VALUES,
28282912
},
2913+
"format": {
2914+
"jsonld_key": "sms:format",
2915+
"csv_header": "Format",
2916+
"node_label": "format",
2917+
"type": str,
2918+
"required_header": False,
2919+
"edge_rel": False,
2920+
"node_attr_dict": {"default": None},
2921+
"allowed_values": [member.value for member in Format],
2922+
},
28292923
}
28302924

28312925
return map_data_model_relationships

tests/unit/synapseclient/extensions/conftest.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import os
2-
import sys
32
from unittest.mock import Mock
43

54
import pytest
65

76
from synapseclient.extensions.curator.schema_generation import (
7+
DataModelCSVParser,
88
DataModelGraph,
99
DataModelGraphExplorer,
10+
DataModelJSONLDParser,
1011
DataModelParser,
1112
DataModelRelationships,
1213
)
@@ -68,3 +69,33 @@ def DMGE(helpers: Helpers) -> DataModelGraphExplorer:
6869
def fixture_dmr():
6970
"Returns a DataModelRelationships instance"
7071
return DataModelRelationships()
72+
73+
74+
@pytest.fixture(name="dmp")
75+
def fixture_dmp(helpers: Helpers) -> DataModelParser:
76+
"Returns a DataModelParser using the csv data model"
77+
data_model_path = helpers.get_schema_file_path("example.model.csv")
78+
dmp = DataModelParser(data_model_path, logger=Mock())
79+
return dmp
80+
81+
82+
@pytest.fixture(name="dmp_jsonld")
83+
def fixture_dmp_json_ld(helpers: Helpers) -> DataModelParser:
84+
"Returns a DataModelParser using the jsonld data model"
85+
data_model_path = helpers.get_schema_file_path("example.model.jsonld")
86+
dmp = DataModelParser(data_model_path, logger=Mock())
87+
return dmp
88+
89+
90+
@pytest.fixture(name="csv_dmp")
91+
def fixture_csv_dmp() -> DataModelCSVParser:
92+
"Returns a DataModelCSVParser"
93+
dmp = DataModelCSVParser(logger=Mock())
94+
return dmp
95+
96+
97+
@pytest.fixture(name="jsonld_dmp")
98+
def fixture_jsonld_dmp() -> DataModelCSVParser:
99+
"Returns a DataModelJSONLDParser"
100+
dmp = DataModelJSONLDParser()
101+
return dmp
Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
1-
Attribute,Description,Valid Values,DependsOn,Properties,Required,Parent,DependsOn Component,Source,Validation Rules,columnType
2-
Component,,,,,TRUE,,,,,
3-
Patient,,,"Patient ID, Sex, Year of Birth, Diagnosis, Component",,FALSE,DataType,,,,
4-
Patient ID,,,,,TRUE,DataProperty,,,#Patient unique warning^^#Biospecimen unique error,
5-
Sex,,"Female, Male, Other",,,TRUE,DataProperty,,,,
6-
Year of Birth,,,,,FALSE,DataProperty,,,,
7-
Diagnosis,,"Healthy, Cancer",,,TRUE,DataProperty,,,,
8-
Cancer,,,"Cancer Type, Family History",,FALSE,ValidValue,,,,
9-
Cancer Type,,"Breast, Colorectal, Lung, Prostate, Skin",,,TRUE,DataProperty,,,,
10-
Family History,,"Breast, Colorectal, Lung, Prostate, Skin",,,TRUE,DataProperty,,,list strict,
11-
Biospecimen,,,"Sample ID, Patient ID, Tissue Status, Component",,FALSE,DataType,Patient,,,
12-
Sample ID,,,,,TRUE,DataProperty,,,,
13-
Tissue Status,,"Healthy, Malignant, None",,,TRUE,DataProperty,,,,
14-
Bulk RNA-seq Assay,,,"Filename, Sample ID, File Format, Component",,FALSE,DataType,Biospecimen,,,
15-
Filename,,,,,TRUE,DataProperty,,,#MockFilename filenameExists^^,
16-
File Format,,"FASTQ, BAM, CRAM, CSV/TSV",,,TRUE,DataProperty,,,,
17-
BAM,,,Genome Build,,FALSE,ValidValue,,,,
18-
CRAM,,,"Genome Build, Genome FASTA",,FALSE,ValidValue,,,,
19-
CSV/TSV,,,Genome Build,,FALSE,ValidValue,,,,
20-
Genome Build,,"GRCh37, GRCh38, GRCm38, GRCm39",,,TRUE,DataProperty,,,,
21-
Genome FASTA,,,,,TRUE,DataProperty,,,,
22-
MockComponent,Component to hold mock attributes for testing all validation rules,,"Component, Check List, Check List Enum, Check List Like, Check List Like Enum, Check List Strict, Check List Enum Strict, Check Regex List, Check Regex List Like, Check Regex List Strict, Check Regex Single, Check Regex Format, Check Regex Integer, Check Num, Check Float, Check Int, Check String, Check URL,Check Match at Least, Check Match at Least values, Check Match Exactly, Check Match Exactly values, Check Match None, Check Match None values, Check Recommended, Check Ages, Check Unique, Check Range, Check Date, Check NA",,FALSE,DataType,,,,
23-
Check List,,,,,TRUE,DataProperty,,,list,
24-
Check List Enum,,"ab, cd, ef, gh",,,TRUE,DataProperty,,,list,
25-
Check List Like,,,,,TRUE,DataProperty,,,list like,
26-
Check List Like Enum,,"ab, cd, ef, gh",,,TRUE,DataProperty,,,list like,
27-
Check List Strict,,,,,TRUE,DataProperty,,,list strict,
28-
Check List Enum Strict,,"ab, cd, ef, gh",,,TRUE,DataProperty,,,list strict,
29-
Check Regex List,,,,,TRUE,DataProperty,,,list::regex match [a-f],
30-
Check Regex List Strict,,,,,TRUE,DataProperty,,,list strict::regex match [a-f],
31-
Check Regex List Like,,,,,TRUE,DataProperty,,,list like::regex match [a-f],
32-
Check Regex Single,,,,,TRUE,DataProperty,,,regex search [a-f],
33-
Check Regex Format,,,,,TRUE,DataProperty,,,regex match [a-f],
34-
Check Regex Integer,,,,,TRUE,DataProperty,,,regex search ^\d+$,
35-
Check Num,,,,,TRUE,DataProperty,,,num error,
36-
Check Float,,,,,TRUE,DataProperty,,,float error,
37-
Check Int,,,,,TRUE,DataProperty,,,int error,
38-
Check String,,,,,TRUE,DataProperty,,,str error,
39-
Check URL,,,,,TRUE,DataProperty,,,url,
40-
Check Match at Least,,,,,TRUE,DataProperty,,,matchAtLeastOne Patient.PatientID set,
41-
Check Match Exactly,,,,,TRUE,DataProperty,,,matchExactlyOne MockComponent.checkMatchExactly set,
42-
Check Match None,,,,,TRUE,DataProperty,,,matchNone MockComponent.checkMatchNone set error,
43-
Check Match at Least values,,,,,TRUE,DataProperty,,,matchAtLeastOne MockComponent.checkMatchatLeastvalues value,
44-
Check Match Exactly values,,,,,TRUE,DataProperty,,,matchExactlyOne MockComponent.checkMatchExactlyvalues value,
45-
Check Match None values,,,,,TRUE,DataProperty,,,matchNone MockComponent.checkMatchNonevalues value error,
46-
Check Recommended,,,,,FALSE,DataProperty,,,recommended,
47-
Check Ages,,,,,TRUE,DataProperty,,,protectAges,
48-
Check Unique,,,,,TRUE,DataProperty,,,unique error,
49-
Check Range,,,,,TRUE,DataProperty,,,inRange 50 100 error,
50-
Check Date,,,,,TRUE,DataProperty,,,date,
51-
Check NA,,,,,TRUE,DataProperty,,,int::IsNA,
52-
MockRDB,,,"Component, MockRDB_id, SourceManifest",,FALSE,DataType,,,,
53-
MockRDB_id,,,,,TRUE,DataProperty,,,int,
54-
SourceManifest,,,,,TRUE,DataProperty,,,,
55-
MockFilename,,,"Component, Filename",,FALSE,DataType,,,,
56-
JSONSchemaComponent,Component to hold attributes for testing JSON Schemas,,"Component, No Rules, No Rules Not Required, String, String Not Required, Enum, Enum Not Required, Date, URL, InRange, Regex, List, List Not Required, List Enum, List Enum Not Required, List Boolean, List, Integer, List InRange",,FALSE,DataType,,,,
57-
No Rules,,,,,TRUE,DataProperty,,,,
58-
No Rules Not Required,,,,,FALSE,DataProperty,,,,
59-
String,,,,,TRUE,DataProperty,,,,string
60-
String Not Required,,,,,FALSE,DataProperty,,,,string
61-
Enum,,"ab, cd, ef, gh",,,TRUE,DataProperty,,,,string
62-
Enum Not Required,,"ab, cd, ef, gh",,,FALSE,DataProperty,,,,string
63-
Date,,,,,TRUE,DataProperty,,,date,string
64-
URL,,,,,TRUE,DataProperty,,,url,string
65-
InRange,,,,,TRUE,DataProperty,,,inRange 50 100,number
66-
Regex,,,,,TRUE,DataProperty,,,regex search [a-f],string
67-
List,,,,,TRUE,DataProperty,,,,string_list
68-
List Not Required,,,,,FALSE,DataProperty,,,,string_list
69-
List Enum,,"ab, cd, ef, gh",,,TRUE,DataProperty,,,,string_list
70-
List Enum Not Required,,"ab, cd, ef, gh",,,FALSE,DataProperty,,,,string_list
71-
List Boolean,,,,,TRUE,DataProperty,,,,boolean_list
72-
List Integer,,,,,TRUE,DataProperty,,,,integer_list
73-
List InRange,,,,,TRUE,DataProperty,,,inRange 50 100,integer_list
74-
TypeDefinitionComponent,Component to check type specification,,"Component, String type, String type caps, Int type, Int type caps, Num type, Num type caps, Nan type, Missing type, Boolean type, Boolean type caps",,FALSE,DataType,,,,
75-
String type,,,,,TRUE,DataProperty,,,,string
76-
String type caps,,,,,TRUE,DataProperty,,,,STRING
77-
Int type,,,,,TRUE,DataProperty,,,,integer
78-
Int type caps,,,,,TRUE,DataProperty,,,,INTEGER
79-
Num type,,,,,TRUE,DataProperty,,,,number
80-
Num type caps,,,,,TRUE,DataProperty,,,,NUMBER
81-
Nan type,,,,,TRUE,DataProperty,,,,nan
82-
Missing type,,,,,TRUE,DataProperty,,,,
83-
Boolean type,,,,,TRUE,DataProperty,,,,boolean
84-
Boolean type caps,,,,,TRUE,DataProperty,,,,BOOLEAN
1+
Attribute,Description,Valid Values,DependsOn,Properties,Required,Parent,DependsOn Component,Source,Validation Rules,columnType,Format
2+
Component,,,,,TRUE,,,,,,
3+
Patient,,,"Patient ID, Sex, Year of Birth, Diagnosis, Component",,FALSE,DataType,,,,,
4+
Patient ID,,,,,TRUE,DataProperty,,,#Patient unique warning^^#Biospecimen unique error,,
5+
Sex,,"Female, Male, Other",,,TRUE,DataProperty,,,,,
6+
Year of Birth,,,,,FALSE,DataProperty,,,,,
7+
Diagnosis,,"Healthy, Cancer",,,TRUE,DataProperty,,,,,
8+
Cancer,,,"Cancer Type, Family History",,FALSE,ValidValue,,,,,
9+
Cancer Type,,"Breast, Colorectal, Lung, Prostate, Skin",,,TRUE,DataProperty,,,,,
10+
Family History,,"Breast, Colorectal, Lung, Prostate, Skin",,,TRUE,DataProperty,,,list strict,,
11+
Biospecimen,,,"Sample ID, Patient ID, Tissue Status, Component",,FALSE,DataType,Patient,,,,
12+
Sample ID,,,,,TRUE,DataProperty,,,,,
13+
Tissue Status,,"Healthy, Malignant, None",,,TRUE,DataProperty,,,,,
14+
Bulk RNA-seq Assay,,,"Filename, Sample ID, File Format, Component",,FALSE,DataType,Biospecimen,,,,
15+
Filename,,,,,TRUE,DataProperty,,,#MockFilename filenameExists^^,,
16+
File Format,,"FASTQ, BAM, CRAM, CSV/TSV",,,TRUE,DataProperty,,,,,
17+
BAM,,,Genome Build,,FALSE,ValidValue,,,,,
18+
CRAM,,,"Genome Build, Genome FASTA",,FALSE,ValidValue,,,,,
19+
CSV/TSV,,,Genome Build,,FALSE,ValidValue,,,,,
20+
Genome Build,,"GRCh37, GRCh38, GRCm38, GRCm39",,,TRUE,DataProperty,,,,,
21+
Genome FASTA,,,,,TRUE,DataProperty,,,,,
22+
MockComponent,Component to hold mock attributes for testing all validation rules,,"Component, Check List, Check List Enum, Check List Like, Check List Like Enum, Check List Strict, Check List Enum Strict, Check Regex List, Check Regex List Like, Check Regex List Strict, Check Regex Single, Check Regex Format, Check Regex Integer, Check Num, Check Float, Check Int, Check String, Check URL,Check Match at Least, Check Match at Least values, Check Match Exactly, Check Match Exactly values, Check Match None, Check Match None values, Check Recommended, Check Ages, Check Unique, Check Range, Check Date, Check NA",,FALSE,DataType,,,,,
23+
Check List,,,,,TRUE,DataProperty,,,list,,
24+
Check List Enum,,"ab, cd, ef, gh",,,TRUE,DataProperty,,,list,,
25+
Check List Like,,,,,TRUE,DataProperty,,,list like,,
26+
Check List Like Enum,,"ab, cd, ef, gh",,,TRUE,DataProperty,,,list like,,
27+
Check List Strict,,,,,TRUE,DataProperty,,,list strict,,
28+
Check List Enum Strict,,"ab, cd, ef, gh",,,TRUE,DataProperty,,,list strict,,
29+
Check Regex List,,,,,TRUE,DataProperty,,,list::regex match [a-f],,
30+
Check Regex List Strict,,,,,TRUE,DataProperty,,,list strict::regex match [a-f],,
31+
Check Regex List Like,,,,,TRUE,DataProperty,,,list like::regex match [a-f],,
32+
Check Regex Single,,,,,TRUE,DataProperty,,,regex search [a-f],,
33+
Check Regex Format,,,,,TRUE,DataProperty,,,regex match [a-f],,
34+
Check Regex Integer,,,,,TRUE,DataProperty,,,regex search ^\d+$,,
35+
Check Num,,,,,TRUE,DataProperty,,,num error,,
36+
Check Float,,,,,TRUE,DataProperty,,,float error,,
37+
Check Int,,,,,TRUE,DataProperty,,,int error,,
38+
Check String,,,,,TRUE,DataProperty,,,str error,,
39+
Check URL,,,,,TRUE,DataProperty,,,url,string,uri
40+
Check Match at Least,,,,,TRUE,DataProperty,,,matchAtLeastOne Patient.PatientID set,,
41+
Check Match Exactly,,,,,TRUE,DataProperty,,,matchExactlyOne MockComponent.checkMatchExactly set,,
42+
Check Match None,,,,,TRUE,DataProperty,,,matchNone MockComponent.checkMatchNone set error,,
43+
Check Match at Least values,,,,,TRUE,DataProperty,,,matchAtLeastOne MockComponent.checkMatchatLeastvalues value,,
44+
Check Match Exactly values,,,,,TRUE,DataProperty,,,matchExactlyOne MockComponent.checkMatchExactlyvalues value,,
45+
Check Match None values,,,,,TRUE,DataProperty,,,matchNone MockComponent.checkMatchNonevalues value error,,
46+
Check Recommended,,,,,FALSE,DataProperty,,,recommended,,
47+
Check Ages,,,,,TRUE,DataProperty,,,protectAges,,
48+
Check Unique,,,,,TRUE,DataProperty,,,unique error,,
49+
Check Range,,,,,TRUE,DataProperty,,,inRange 50 100 error,,
50+
Check Date,,,,,TRUE,DataProperty,,,date,string,date
51+
Check NA,,,,,TRUE,DataProperty,,,int::IsNA,,
52+
MockRDB,,,"Component, MockRDB_id, SourceManifest",,FALSE,DataType,,,,,
53+
MockRDB_id,,,,,TRUE,DataProperty,,,int,,
54+
SourceManifest,,,,,TRUE,DataProperty,,,,,
55+
MockFilename,,,"Component, Filename",,FALSE,DataType,,,,,
56+
JSONSchemaComponent,Component to hold attributes for testing JSON Schemas,,"Component, No Rules, No Rules Not Required, String, String Not Required, Enum, Enum Not Required, Date, URL, InRange, Regex, List, List Not Required, List Enum, List Enum Not Required, List Boolean, List, Integer, List InRange",,FALSE,DataType,,,,,
57+
No Rules,,,,,TRUE,DataProperty,,,,,
58+
No Rules Not Required,,,,,FALSE,DataProperty,,,,,
59+
String,,,,,TRUE,DataProperty,,,,string,
60+
String Not Required,,,,,FALSE,DataProperty,,,,string,
61+
Enum,,"ab, cd, ef, gh",,,TRUE,DataProperty,,,,string,
62+
Enum Not Required,,"ab, cd, ef, gh",,,FALSE,DataProperty,,,,string,
63+
Date,,,,,TRUE,DataProperty,,,date,string,date
64+
URL,,,,,TRUE,DataProperty,,,url,string,uri
65+
InRange,,,,,TRUE,DataProperty,,,inRange 50 100,number,
66+
Regex,,,,,TRUE,DataProperty,,,regex search [a-f],string,
67+
List,,,,,TRUE,DataProperty,,,,string_list,
68+
List Not Required,,,,,FALSE,DataProperty,,,,string_list,
69+
List Enum,,"ab, cd, ef, gh",,,TRUE,DataProperty,,,,string_list,
70+
List Enum Not Required,,"ab, cd, ef, gh",,,FALSE,DataProperty,,,,string_list,
71+
List Boolean,,,,,TRUE,DataProperty,,,,boolean_list,
72+
List Integer,,,,,TRUE,DataProperty,,,,integer_list,
73+
List InRange,,,,,TRUE,DataProperty,,,inRange 50 100,integer_list,
74+
TypeDefinitionComponent,Component to check type specification,,"Component, String type, String type caps, Int type, Int type caps, Num type, Num type caps, Nan type, Missing type, Boolean type, Boolean type caps",,FALSE,DataType,,,,,
75+
String type,,,,,TRUE,DataProperty,,,,string,
76+
String type caps,,,,,TRUE,DataProperty,,,,STRING,
77+
Int type,,,,,TRUE,DataProperty,,,,integer,
78+
Int type caps,,,,,TRUE,DataProperty,,,,INTEGER,
79+
Num type,,,,,TRUE,DataProperty,,,,number,
80+
Num type caps,,,,,TRUE,DataProperty,,,,NUMBER,
81+
Nan type,,,,,TRUE,DataProperty,,,,nan,
82+
Missing type,,,,,TRUE,DataProperty,,,,,
83+
Boolean type,,,,,TRUE,DataProperty,,,,boolean,
84+
Boolean type caps,,,,,TRUE,DataProperty,,,,BOOLEAN,

tests/unit/synapseclient/extensions/unit_test_data_model_graph_explorer.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
AtomicColumnType,
77
ColumnType,
88
DataModelGraphExplorer,
9+
Format,
910
ListColumnType,
1011
)
1112

@@ -66,3 +67,13 @@ def test_get_node_column_type(
6667
dmge: DataModelGraphExplorer, node_label: str, column_type: ColumnType
6768
) -> None:
6869
assert dmge.get_node_column_type(node_label) == column_type
70+
71+
72+
@pytest.mark.parametrize(
73+
"node_label, column_type",
74+
[("String", None), ("Date", Format.DATE), ("URL", Format.URI)],
75+
)
76+
def test_get_node_format(
77+
dmge: DataModelGraphExplorer, node_label: str, column_type: Format
78+
) -> None:
79+
assert dmge.get_node_format(node_label) == column_type

0 commit comments

Comments
 (0)