def test_temporal_coverage_validate(self): coverage = {} self.assertEqual(Utils.temporal_coverage_validate(coverage), { "start": None, "end": None }) coverage = {"start": None} self.assertEqual(Utils.temporal_coverage_validate(coverage), { "start": None, "end": None }) coverage = {"end": None} self.assertEqual(Utils.temporal_coverage_validate(coverage), { "start": None, "end": None }) coverage = {"start": "2018-09-23T00:00:00", "end": "2018-10-10"} self.assertEqual(Utils.temporal_coverage_validate(coverage), { 'end': '2018-10-10T00:00:00', 'start': '2018-09-23T00:00:00' }) coverage = {"start": "2018-00", "end": "2018-10-10"} self.assertEqual(Utils.temporal_coverage_validate(coverage), { 'end': '2018-10-10T00:00:00', 'start': None })
def test_temporal_coverage_validate(self): print("[Test]{}/test_temporal_coverage_validate".format( self.__class__.__name__)) coverage = {} self.assertEqual(Utils.temporal_coverage_validate(coverage), { "start": None, "end": None }) coverage = {"start": None} self.assertEqual(Utils.temporal_coverage_validate(coverage), { "start": None, "end": None }) coverage = {"end": None} self.assertEqual(Utils.temporal_coverage_validate(coverage), { "start": None, "end": None }) coverage = {"start": "2018-09-23T00:00:00", "end": "2018-10-10"} self.assertEqual(Utils.temporal_coverage_validate(coverage), { 'end': '2018-10-10T00:00:00', 'start': '2018-09-23T00:00:00' }) coverage = {"start": "2018-00", "end": "2018-10-10"} self.assertEqual(Utils.temporal_coverage_validate(coverage), { 'end': '2018-10-10T00:00:00', 'start': None }) print(colored('.Done', 'red'))
def __init__(self, description: dict, datamart_id: int): """Init method of VariableMetadata. Args: description: description dict. datamart_id: unique datamart_id. Returns: """ super().__init__() self._metadata["datamart_id"] = datamart_id if "name" in description: self._metadata["name"] = description["name"] if "description" in description: self._metadata["description"] = description["description"] self._metadata["semantic_type"] = description.get("semantic_type", []) if "named_entity" in description: self._metadata["named_entity"] = description["named_entity"] if "temporal_coverage" in description: self._metadata["temporal_coverage"] = description[ "temporal_coverage"] if self.temporal_coverage: self.temporal_coverage = Utils.temporal_coverage_validate( self.temporal_coverage) if "spatial_coverage" in description: self._metadata["spatial_coverage"] = description[ "spatial_coverage"]