From 699c2c3d7ce16c41a7d11b4e0188d09c5447c639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateo=20de=20Lorenzo=20Argel=C3=A9s?= <160473799+mla2001@users.noreply.github.com> Date: Mon, 20 Jan 2025 09:07:42 +0100 Subject: [PATCH] 45 check time period comparison (#46) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed Time_Period compraison (It just compare the period instead of the date itself). Refactored all time period tests to work with pytest. Added some basic Time_Period comparison tests: =, <>, <, >, <=, >=. * Fixed Time Period Comparison tests. * Fixed mypy and ruff errors. * Fixed ruff error. * Merged main into branch. * Refactored timePeriod meta comparison. Updated tests to work with the new comparison criteria. * meta_comparison optimized. * Fixed ruff errors. * Fixed mypy errors. * Ruff format launched. * Ruff format launched. * Ruff format launched. * Fixed last version mypy errors. * Updated pyproject: mypy and ruff versions. --------- Signed-off-by: Mateo de Lorenzo Argelés <160473799+mla2001@users.noreply.github.com> Co-authored-by: Francisco Javier Hernández del Caño --- pyproject.toml | 2 +- .../AST/ASTConstructorModules/Expr.py | 20 -- src/vtlengine/DataTypes/TimeHandling.py | 45 +++- src/vtlengine/Operators/Conditional.py | 1 + src/vtlengine/Operators/HROperators.py | 4 +- .../data/DataSet/output/5-4-1-27-1.csv | 2 +- .../data/DataSet/output/5-4-1-28-1.csv | 10 +- tests/Bugs/data/vtl/GL_195_1.vtl | 2 +- tests/TimePeriod/conftest.py | 48 ++++ tests/TimePeriod/data/DataSet/input/1-1.csv | 49 ++++ tests/TimePeriod/data/DataSet/input/2-1.csv | 49 ++++ tests/TimePeriod/data/DataSet/input/3-1.csv | 49 ++++ tests/TimePeriod/data/DataSet/input/4-1.csv | 49 ++++ tests/TimePeriod/data/DataSet/input/5-1.csv | 49 ++++ tests/TimePeriod/data/DataSet/input/6-1.csv | 49 ++++ tests/TimePeriod/data/DataSet/output/1-1.csv | 2 + tests/TimePeriod/data/DataSet/output/2-1.csv | 49 ++++ tests/TimePeriod/data/DataSet/output/3-1.csv | 32 +++ tests/TimePeriod/data/DataSet/output/4-1.csv | 24 ++ tests/TimePeriod/data/DataSet/output/5-1.csv | 32 +++ tests/TimePeriod/data/DataSet/output/6-1.csv | 20 ++ .../data/DataSet/output/GL_416-1.csv | 140 ----------- .../data/DataStructure/input/1-1.json | 45 ++++ .../data/DataStructure/input/2-1.json | 45 ++++ .../data/DataStructure/input/3-1.json | 45 ++++ .../data/DataStructure/input/4-1.json | 45 ++++ .../data/DataStructure/input/5-1.json | 45 ++++ .../data/DataStructure/input/6-1.json | 45 ++++ .../data/DataStructure/output/1-1.json | 45 ++++ .../data/DataStructure/output/2-1.json | 45 ++++ .../data/DataStructure/output/3-1.json | 45 ++++ .../data/DataStructure/output/4-1.json | 45 ++++ .../data/DataStructure/output/5-1.json | 45 ++++ .../data/DataStructure/output/6-1.json | 45 ++++ tests/TimePeriod/data/vtl/1.vtl | 0 tests/TimePeriod/data/vtl/2.vtl | 1 + tests/TimePeriod/data/vtl/3.vtl | 0 tests/TimePeriod/data/vtl/4.vtl | 0 tests/TimePeriod/data/vtl/5.vtl | 0 tests/TimePeriod/test_timeperiod.py | 226 +++++------------- 40 files changed, 1156 insertions(+), 338 deletions(-) create mode 100644 tests/TimePeriod/conftest.py create mode 100644 tests/TimePeriod/data/DataSet/input/1-1.csv create mode 100644 tests/TimePeriod/data/DataSet/input/2-1.csv create mode 100644 tests/TimePeriod/data/DataSet/input/3-1.csv create mode 100644 tests/TimePeriod/data/DataSet/input/4-1.csv create mode 100644 tests/TimePeriod/data/DataSet/input/5-1.csv create mode 100644 tests/TimePeriod/data/DataSet/input/6-1.csv create mode 100644 tests/TimePeriod/data/DataSet/output/1-1.csv create mode 100644 tests/TimePeriod/data/DataSet/output/2-1.csv create mode 100644 tests/TimePeriod/data/DataSet/output/3-1.csv create mode 100644 tests/TimePeriod/data/DataSet/output/4-1.csv create mode 100644 tests/TimePeriod/data/DataSet/output/5-1.csv create mode 100644 tests/TimePeriod/data/DataSet/output/6-1.csv create mode 100644 tests/TimePeriod/data/DataStructure/input/1-1.json create mode 100644 tests/TimePeriod/data/DataStructure/input/2-1.json create mode 100644 tests/TimePeriod/data/DataStructure/input/3-1.json create mode 100644 tests/TimePeriod/data/DataStructure/input/4-1.json create mode 100644 tests/TimePeriod/data/DataStructure/input/5-1.json create mode 100644 tests/TimePeriod/data/DataStructure/input/6-1.json create mode 100644 tests/TimePeriod/data/DataStructure/output/1-1.json create mode 100644 tests/TimePeriod/data/DataStructure/output/2-1.json create mode 100644 tests/TimePeriod/data/DataStructure/output/3-1.json create mode 100644 tests/TimePeriod/data/DataStructure/output/4-1.json create mode 100644 tests/TimePeriod/data/DataStructure/output/5-1.json create mode 100644 tests/TimePeriod/data/DataStructure/output/6-1.json create mode 100644 tests/TimePeriod/data/vtl/1.vtl create mode 100644 tests/TimePeriod/data/vtl/2.vtl create mode 100644 tests/TimePeriod/data/vtl/3.vtl create mode 100644 tests/TimePeriod/data/vtl/4.vtl create mode 100644 tests/TimePeriod/data/vtl/5.vtl diff --git a/pyproject.toml b/pyproject.toml index 87e42aea..5833dfdf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ pytest-cov = "^5.0.0" line-profiler-pycharm = "^1.2.0" sphinx = "^7.4" sphinx-rtd-theme = "^2.0.0" -mypy = "^1.11.2" +mypy = "^1.14.1" pandas-stubs = "^2.2.3.241009" stubs = "^1.0.0" toml = "^0.10.2" diff --git a/src/vtlengine/AST/ASTConstructorModules/Expr.py b/src/vtlengine/AST/ASTConstructorModules/Expr.py index 93bb1a64..21215a9b 100644 --- a/src/vtlengine/AST/ASTConstructorModules/Expr.py +++ b/src/vtlengine/AST/ASTConstructorModules/Expr.py @@ -828,26 +828,6 @@ def visitTimeUnaryAtom(self, ctx: Any): return UnaryOp(op=op, operand=operand_node[0]) - # def visitPeriodAtom(self, ctx: Parser.PeriodAtomContext): - # """ - # periodExpr: PERIOD_INDICATOR '(' expr? ')' ; - # """ - # ctx_list = list(ctx.getChildren()) - # c = ctx_list[0] - # - # op = c.getSymbol().text - # operand_node = [ - # self.visitExpr(operand) - # for operand in ctx_list - # if isinstance(operand, Parser.ExprContext) - # ] - # - # if len(operand_node) == 0: - # # AST_ASTCONSTRUCTOR.15 - # raise NotImplementedError - # - # return UnaryOp(op=op, operand=operand_node[0]) - def visitTimeShiftAtom(self, ctx: Parser.TimeShiftAtomContext): """ timeShiftExpr: TIMESHIFT '(' expr ',' INTEGER_CONSTANT ')' ; diff --git a/src/vtlengine/DataTypes/TimeHandling.py b/src/vtlengine/DataTypes/TimeHandling.py index f6e1a531..9690e457 100644 --- a/src/vtlengine/DataTypes/TimeHandling.py +++ b/src/vtlengine/DataTypes/TimeHandling.py @@ -203,6 +203,10 @@ def period_indicator(self, value: str) -> None: raise SemanticError("2-1-19-2", period=value) self._period_indicator = value + @property + def period_magnitude(self) -> int: + return DURATION_MAPPING[self.period_indicator] + @property def period_number(self) -> int: return self._period_number @@ -230,17 +234,46 @@ def period_number(self, value: int) -> None: # raise ValueError(f'Invalid day {value} for year {self.year}.') self._period_number = value + @property + def period_dates(self) -> tuple[date, date]: + return ( + period_to_date(self.year, self.period_indicator, self.period_number, start=True), + period_to_date(self.year, self.period_indicator, self.period_number, start=False), + ) + def _meta_comparison(self, other: Any, py_op: Any) -> Optional[bool]: if pd.isnull(other): return None + + if py_op in (operator.eq, operator.ne): + return py_op(str(self), str(other)) + + if py_op in (operator.ge, operator.le) and str(self) == str(other): + return True + if isinstance(other, str): - if len(other) == 0: - return False other = TimePeriodHandler(other) - return py_op( - DURATION_MAPPING[self.period_indicator], - DURATION_MAPPING[other.period_indicator], - ) + + self_lapse, other_lapse = self.period_dates, other.period_dates + is_lt_or_le = py_op in [operator.lt, operator.le] + is_gt_or_ge = py_op in [operator.gt, operator.ge] + + if is_lt_or_le or is_gt_or_ge: + idx = 0 if is_lt_or_le else 1 + if self_lapse[idx] != other_lapse[idx]: + return ( + self_lapse[idx] < other_lapse[idx] + if is_lt_or_le + else self_lapse[idx] > other_lapse[idx] + ) + if self.period_magnitude != other.period_magnitude: + return ( + self.period_magnitude < other.period_magnitude + if is_lt_or_le + else self.period_magnitude > other.period_magnitude + ) + + return False def start_date(self, as_date: bool = False) -> Union[date, str]: """ diff --git a/src/vtlengine/Operators/Conditional.py b/src/vtlengine/Operators/Conditional.py index a46c1fc5..176d33f2 100644 --- a/src/vtlengine/Operators/Conditional.py +++ b/src/vtlengine/Operators/Conditional.py @@ -66,6 +66,7 @@ def component_level_evaluation( else: false_data = false_branch.data.reindex(condition.data.index) result = np.where(condition.data, true_data, false_data) + return pd.Series(result, index=condition.data.index) # type: ignore[union-attr] @classmethod diff --git a/src/vtlengine/Operators/HROperators.py b/src/vtlengine/Operators/HROperators.py index 556dad36..82659c36 100644 --- a/src/vtlengine/Operators/HROperators.py +++ b/src/vtlengine/Operators/HROperators.py @@ -26,9 +26,7 @@ def get_measure_from_dataset(dataset: Dataset, code_item: str) -> DataComponent: class HRComparison(Operators.Binary): @classmethod def imbalance_func(cls, x: Any, y: Any) -> Any: - if pd.isnull(x) or pd.isnull(y): - return None - return x - y + return None if pd.isnull(x) or pd.isnull(y) else x - y @staticmethod def hr_func(left_series: Any, right_series: Any, hr_mode: str) -> Any: diff --git a/tests/Attributes/data/DataSet/output/5-4-1-27-1.csv b/tests/Attributes/data/DataSet/output/5-4-1-27-1.csv index fe8ff84c..38be8c15 100644 --- a/tests/Attributes/data/DataSet/output/5-4-1-27-1.csv +++ b/tests/Attributes/data/DataSet/output/5-4-1-27-1.csv @@ -1,5 +1,5 @@ Id_1,Id_2,Id_3,Id_4,bool_var -2012,B,Total,Total,True +2012,B,Total,Total,False 2012,G,Total,Total,True 2012,S,Total,Total,True 2012,M,Total,Total,True diff --git a/tests/Attributes/data/DataSet/output/5-4-1-28-1.csv b/tests/Attributes/data/DataSet/output/5-4-1-28-1.csv index 5d21b7c6..7a8f2733 100644 --- a/tests/Attributes/data/DataSet/output/5-4-1-28-1.csv +++ b/tests/Attributes/data/DataSet/output/5-4-1-28-1.csv @@ -1,7 +1,7 @@ Id_1,Id_2,Id_3,Id_4,Me_1,Me_2,At_1,At_2,Me_3 2012,B,Total,Total,2010Q3,2010Q3,Dolar,Euro,True -2012,G,Total,Total,2010Q1,2010Q3,Dolar,Euro,True -2012,S,Total,Total,2010Q1,2010Q3,Dolar,Euro,True -2012,M,Total,Total,2010Q1,2010Q3,Dolar,Euro,True -2012,F,Total,Total,2010Q1,2010Q3,Dolar,Euro,True -2012,W,Total,Total,2010Q1,2010Q3,Dolar,Euro,True +2012,G,Total,Total,2010Q1,2010Q3,Dolar,Euro,False +2012,S,Total,Total,2010Q1,2010Q3,Dolar,Euro,False +2012,M,Total,Total,2010Q1,2010Q3,Dolar,Euro,False +2012,F,Total,Total,2010Q1,2010Q3,Dolar,Euro,False +2012,W,Total,Total,2010Q1,2010Q3,Dolar,Euro,False diff --git a/tests/Bugs/data/vtl/GL_195_1.vtl b/tests/Bugs/data/vtl/GL_195_1.vtl index dda6cc35..c3667485 100644 --- a/tests/Bugs/data/vtl/GL_195_1.vtl +++ b/tests/Bugs/data/vtl/GL_195_1.vtl @@ -1 +1 @@ -B03.ANAMART_INSTRMNT_SHR_ONA_CRDTR := B03.INSTRMNT_FCT_TRNSFRRD_AMNT [ calc SHR_ONA_CRDTR := if OTSTNDNG_NMNL_AMNT = 0 then 1 / NMBR_CRDTR else ( if OBSRVD_AGNT_CD = CRDTR_ID then ( OTSTNDNG_NMNL_AMNT - TRNSFRRD_AMNT ) / OTSTNDNG_NMNL_AMNT else ( if OTSTNDNG_NMNL_AMNT * NMBR_CRDTRS_NT_OA = 0.0 then 1 else TRNSFRRD_AMNT / ( OTSTNDNG_NMNL_AMNT * NMBR_CRDTRS_NT_OA ) ) ) ] [ keep SHR_ONA_CRDTR ] ; \ No newline at end of file +B03.ANAMART_INSTRMNT_SHR_ONA_CRDTR := B03.INSTRMNT_FCT_TRNSFRRD_AMNT [ calc SHR_ONA_CRDTR := if OTSTNDNG_NMNL_AMNT = 0 then 1 / NMBR_CRDTR else ( if OBSRVD_AGNT_CD = CRDTR_ID then ( OTSTNDNG_NMNL_AMNT - TRNSFRRD_AMNT ) / OTSTNDNG_NMNL_AMNT else ( if OTSTNDNG_NMNL_AMNT * NMBR_CRDTRS_NT_OA = 0.0 then 1 else TRNSFRRD_AMNT / ( OTSTNDNG_NMNL_AMNT * NMBR_CRDTRS_NT_OA ) ) ) ] [ keep SHR_ONA_CRDTR ] ; \ No newline at end of file diff --git a/tests/TimePeriod/conftest.py b/tests/TimePeriod/conftest.py new file mode 100644 index 00000000..4043e77a --- /dev/null +++ b/tests/TimePeriod/conftest.py @@ -0,0 +1,48 @@ +import json +import os + +import pandas as pd +import pytest + +from vtlengine.API._InternalApi import load_datasets_with_data +from vtlengine.Exceptions import SemanticError + + +def load_datasets(base_path, code, folder_type): + datapoints_path = base_path / "DataSet" / folder_type + input_path = base_path / "DataStructure" / folder_type + + num_inputs = len([f for f in os.listdir(input_path) if f.startswith(f"{code}-")]) + datasets = {} + + for i in range(1, num_inputs + 1): + with open(input_path / f"{code}-{i}.json", "r") as file: + datastructure = json.load(file) + if "datasets" in datastructure: + ds_name = datastructure["datasets"][0]["name"] + datapoint = {ds_name: pd.read_csv(datapoints_path / f"{code}-{i}.csv")} + else: + datapoint = None + datasets.update(load_datasets_with_data(datastructure, datapoint)[0]) + + return datasets + + +@pytest.fixture +def load_input(request, code): + base_path = request.node.get_closest_marker("input_path").args[0] + return load_datasets(base_path, code, folder_type="input") + + +@pytest.fixture +def load_reference(request, code): + base_path = request.node.get_closest_marker("input_path").args[0] + return load_datasets(base_path, code, folder_type="output") + + +@pytest.fixture +def load_error(request, code): + with pytest.raises(SemanticError) as context: + base_path = request.node.get_closest_marker("input_path").args[0] + return load_datasets(base_path, code, folder_type="input") + return context.value.args[1] diff --git a/tests/TimePeriod/data/DataSet/input/1-1.csv b/tests/TimePeriod/data/DataSet/input/1-1.csv new file mode 100644 index 00000000..d98eb786 --- /dev/null +++ b/tests/TimePeriod/data/DataSet/input/1-1.csv @@ -0,0 +1,49 @@ +CONF_STATUS,EXR_CURRENCY,FREQ,OBS_STATUS,OBS_VALUE,TIME_PERIOD +,01,M,,112,2000M1 +,02,M,,212,2000M2 +,03,M,A,312,2000M3 +,04,M,A,412,2000M4 +,05,M,A,512,2000M5 +,CNY,M,A,612,2000M6 +,CNY,M,A,712,2000M7 +,CNY,M,A,812,2000M8 +,CNY,M,A,912,2000M9 +,CNY,M,A,1120,2000M10 +,CNY,M,A,1121,2000M11 +,CNY,M,A,1122,2000M12 +,CNY,M,A,112,2001M1 +,CNY,M,A,212,2001M2 +,CNY,M,A,312,2001M3 +,CNY,M,A,412,2001M4 +,CNY,M,A,512,2001M5 +,CNY,M,A,612,2001M6 +,CNY,M,A,712,2001M7 +,CNY,M,A,812,2001M8 +,CNY,M,A,912,2001M9 +,CNY,M,A,1120,2001M10 +,CNY,M,A,1121,2001M11 +,CNY,M,A,1122,2001M12 +,CNY,M,A,112,2002M1 +,CNY,M,A,212,2002M2 +,CNY,M,A,312,2002M3 +,CNY,M,A,412,2002M4 +,CNY,M,A,512,2002M5 +,CNY,M,A,612,2002M6 +,CNY,M,A,712,2002M7 +,CNY,M,A,812,2002M8 +,CNY,M,A,912,2002M9 +,CNY,M,A,1120,2002M10 +,CNY,M,A,1121,2002M11 +,CNY,M,A,1122,2002M12 +,CNY,M,A,112,2003M1 +,CNY,M,A,212,2003M2 +,CNY,M,A,312,2003M3 +,CNY,M,A,412,2003M4 +,CNY,M,A,512,2003M5 +,CNY,M,A,612,2003M6 +,CNY,M,A,712,2003M7 +,CNY,M,A,812,2003M8 +,CNY,M,A,912,2003M9 +,CNY,M,A,1120,2003M10 +,CNY,M,A,1121,2003M11 +,CNY,M,A,1122,2003M12 \ No newline at end of file diff --git a/tests/TimePeriod/data/DataSet/input/2-1.csv b/tests/TimePeriod/data/DataSet/input/2-1.csv new file mode 100644 index 00000000..d98eb786 --- /dev/null +++ b/tests/TimePeriod/data/DataSet/input/2-1.csv @@ -0,0 +1,49 @@ +CONF_STATUS,EXR_CURRENCY,FREQ,OBS_STATUS,OBS_VALUE,TIME_PERIOD +,01,M,,112,2000M1 +,02,M,,212,2000M2 +,03,M,A,312,2000M3 +,04,M,A,412,2000M4 +,05,M,A,512,2000M5 +,CNY,M,A,612,2000M6 +,CNY,M,A,712,2000M7 +,CNY,M,A,812,2000M8 +,CNY,M,A,912,2000M9 +,CNY,M,A,1120,2000M10 +,CNY,M,A,1121,2000M11 +,CNY,M,A,1122,2000M12 +,CNY,M,A,112,2001M1 +,CNY,M,A,212,2001M2 +,CNY,M,A,312,2001M3 +,CNY,M,A,412,2001M4 +,CNY,M,A,512,2001M5 +,CNY,M,A,612,2001M6 +,CNY,M,A,712,2001M7 +,CNY,M,A,812,2001M8 +,CNY,M,A,912,2001M9 +,CNY,M,A,1120,2001M10 +,CNY,M,A,1121,2001M11 +,CNY,M,A,1122,2001M12 +,CNY,M,A,112,2002M1 +,CNY,M,A,212,2002M2 +,CNY,M,A,312,2002M3 +,CNY,M,A,412,2002M4 +,CNY,M,A,512,2002M5 +,CNY,M,A,612,2002M6 +,CNY,M,A,712,2002M7 +,CNY,M,A,812,2002M8 +,CNY,M,A,912,2002M9 +,CNY,M,A,1120,2002M10 +,CNY,M,A,1121,2002M11 +,CNY,M,A,1122,2002M12 +,CNY,M,A,112,2003M1 +,CNY,M,A,212,2003M2 +,CNY,M,A,312,2003M3 +,CNY,M,A,412,2003M4 +,CNY,M,A,512,2003M5 +,CNY,M,A,612,2003M6 +,CNY,M,A,712,2003M7 +,CNY,M,A,812,2003M8 +,CNY,M,A,912,2003M9 +,CNY,M,A,1120,2003M10 +,CNY,M,A,1121,2003M11 +,CNY,M,A,1122,2003M12 \ No newline at end of file diff --git a/tests/TimePeriod/data/DataSet/input/3-1.csv b/tests/TimePeriod/data/DataSet/input/3-1.csv new file mode 100644 index 00000000..d98eb786 --- /dev/null +++ b/tests/TimePeriod/data/DataSet/input/3-1.csv @@ -0,0 +1,49 @@ +CONF_STATUS,EXR_CURRENCY,FREQ,OBS_STATUS,OBS_VALUE,TIME_PERIOD +,01,M,,112,2000M1 +,02,M,,212,2000M2 +,03,M,A,312,2000M3 +,04,M,A,412,2000M4 +,05,M,A,512,2000M5 +,CNY,M,A,612,2000M6 +,CNY,M,A,712,2000M7 +,CNY,M,A,812,2000M8 +,CNY,M,A,912,2000M9 +,CNY,M,A,1120,2000M10 +,CNY,M,A,1121,2000M11 +,CNY,M,A,1122,2000M12 +,CNY,M,A,112,2001M1 +,CNY,M,A,212,2001M2 +,CNY,M,A,312,2001M3 +,CNY,M,A,412,2001M4 +,CNY,M,A,512,2001M5 +,CNY,M,A,612,2001M6 +,CNY,M,A,712,2001M7 +,CNY,M,A,812,2001M8 +,CNY,M,A,912,2001M9 +,CNY,M,A,1120,2001M10 +,CNY,M,A,1121,2001M11 +,CNY,M,A,1122,2001M12 +,CNY,M,A,112,2002M1 +,CNY,M,A,212,2002M2 +,CNY,M,A,312,2002M3 +,CNY,M,A,412,2002M4 +,CNY,M,A,512,2002M5 +,CNY,M,A,612,2002M6 +,CNY,M,A,712,2002M7 +,CNY,M,A,812,2002M8 +,CNY,M,A,912,2002M9 +,CNY,M,A,1120,2002M10 +,CNY,M,A,1121,2002M11 +,CNY,M,A,1122,2002M12 +,CNY,M,A,112,2003M1 +,CNY,M,A,212,2003M2 +,CNY,M,A,312,2003M3 +,CNY,M,A,412,2003M4 +,CNY,M,A,512,2003M5 +,CNY,M,A,612,2003M6 +,CNY,M,A,712,2003M7 +,CNY,M,A,812,2003M8 +,CNY,M,A,912,2003M9 +,CNY,M,A,1120,2003M10 +,CNY,M,A,1121,2003M11 +,CNY,M,A,1122,2003M12 \ No newline at end of file diff --git a/tests/TimePeriod/data/DataSet/input/4-1.csv b/tests/TimePeriod/data/DataSet/input/4-1.csv new file mode 100644 index 00000000..d98eb786 --- /dev/null +++ b/tests/TimePeriod/data/DataSet/input/4-1.csv @@ -0,0 +1,49 @@ +CONF_STATUS,EXR_CURRENCY,FREQ,OBS_STATUS,OBS_VALUE,TIME_PERIOD +,01,M,,112,2000M1 +,02,M,,212,2000M2 +,03,M,A,312,2000M3 +,04,M,A,412,2000M4 +,05,M,A,512,2000M5 +,CNY,M,A,612,2000M6 +,CNY,M,A,712,2000M7 +,CNY,M,A,812,2000M8 +,CNY,M,A,912,2000M9 +,CNY,M,A,1120,2000M10 +,CNY,M,A,1121,2000M11 +,CNY,M,A,1122,2000M12 +,CNY,M,A,112,2001M1 +,CNY,M,A,212,2001M2 +,CNY,M,A,312,2001M3 +,CNY,M,A,412,2001M4 +,CNY,M,A,512,2001M5 +,CNY,M,A,612,2001M6 +,CNY,M,A,712,2001M7 +,CNY,M,A,812,2001M8 +,CNY,M,A,912,2001M9 +,CNY,M,A,1120,2001M10 +,CNY,M,A,1121,2001M11 +,CNY,M,A,1122,2001M12 +,CNY,M,A,112,2002M1 +,CNY,M,A,212,2002M2 +,CNY,M,A,312,2002M3 +,CNY,M,A,412,2002M4 +,CNY,M,A,512,2002M5 +,CNY,M,A,612,2002M6 +,CNY,M,A,712,2002M7 +,CNY,M,A,812,2002M8 +,CNY,M,A,912,2002M9 +,CNY,M,A,1120,2002M10 +,CNY,M,A,1121,2002M11 +,CNY,M,A,1122,2002M12 +,CNY,M,A,112,2003M1 +,CNY,M,A,212,2003M2 +,CNY,M,A,312,2003M3 +,CNY,M,A,412,2003M4 +,CNY,M,A,512,2003M5 +,CNY,M,A,612,2003M6 +,CNY,M,A,712,2003M7 +,CNY,M,A,812,2003M8 +,CNY,M,A,912,2003M9 +,CNY,M,A,1120,2003M10 +,CNY,M,A,1121,2003M11 +,CNY,M,A,1122,2003M12 \ No newline at end of file diff --git a/tests/TimePeriod/data/DataSet/input/5-1.csv b/tests/TimePeriod/data/DataSet/input/5-1.csv new file mode 100644 index 00000000..d98eb786 --- /dev/null +++ b/tests/TimePeriod/data/DataSet/input/5-1.csv @@ -0,0 +1,49 @@ +CONF_STATUS,EXR_CURRENCY,FREQ,OBS_STATUS,OBS_VALUE,TIME_PERIOD +,01,M,,112,2000M1 +,02,M,,212,2000M2 +,03,M,A,312,2000M3 +,04,M,A,412,2000M4 +,05,M,A,512,2000M5 +,CNY,M,A,612,2000M6 +,CNY,M,A,712,2000M7 +,CNY,M,A,812,2000M8 +,CNY,M,A,912,2000M9 +,CNY,M,A,1120,2000M10 +,CNY,M,A,1121,2000M11 +,CNY,M,A,1122,2000M12 +,CNY,M,A,112,2001M1 +,CNY,M,A,212,2001M2 +,CNY,M,A,312,2001M3 +,CNY,M,A,412,2001M4 +,CNY,M,A,512,2001M5 +,CNY,M,A,612,2001M6 +,CNY,M,A,712,2001M7 +,CNY,M,A,812,2001M8 +,CNY,M,A,912,2001M9 +,CNY,M,A,1120,2001M10 +,CNY,M,A,1121,2001M11 +,CNY,M,A,1122,2001M12 +,CNY,M,A,112,2002M1 +,CNY,M,A,212,2002M2 +,CNY,M,A,312,2002M3 +,CNY,M,A,412,2002M4 +,CNY,M,A,512,2002M5 +,CNY,M,A,612,2002M6 +,CNY,M,A,712,2002M7 +,CNY,M,A,812,2002M8 +,CNY,M,A,912,2002M9 +,CNY,M,A,1120,2002M10 +,CNY,M,A,1121,2002M11 +,CNY,M,A,1122,2002M12 +,CNY,M,A,112,2003M1 +,CNY,M,A,212,2003M2 +,CNY,M,A,312,2003M3 +,CNY,M,A,412,2003M4 +,CNY,M,A,512,2003M5 +,CNY,M,A,612,2003M6 +,CNY,M,A,712,2003M7 +,CNY,M,A,812,2003M8 +,CNY,M,A,912,2003M9 +,CNY,M,A,1120,2003M10 +,CNY,M,A,1121,2003M11 +,CNY,M,A,1122,2003M12 \ No newline at end of file diff --git a/tests/TimePeriod/data/DataSet/input/6-1.csv b/tests/TimePeriod/data/DataSet/input/6-1.csv new file mode 100644 index 00000000..d98eb786 --- /dev/null +++ b/tests/TimePeriod/data/DataSet/input/6-1.csv @@ -0,0 +1,49 @@ +CONF_STATUS,EXR_CURRENCY,FREQ,OBS_STATUS,OBS_VALUE,TIME_PERIOD +,01,M,,112,2000M1 +,02,M,,212,2000M2 +,03,M,A,312,2000M3 +,04,M,A,412,2000M4 +,05,M,A,512,2000M5 +,CNY,M,A,612,2000M6 +,CNY,M,A,712,2000M7 +,CNY,M,A,812,2000M8 +,CNY,M,A,912,2000M9 +,CNY,M,A,1120,2000M10 +,CNY,M,A,1121,2000M11 +,CNY,M,A,1122,2000M12 +,CNY,M,A,112,2001M1 +,CNY,M,A,212,2001M2 +,CNY,M,A,312,2001M3 +,CNY,M,A,412,2001M4 +,CNY,M,A,512,2001M5 +,CNY,M,A,612,2001M6 +,CNY,M,A,712,2001M7 +,CNY,M,A,812,2001M8 +,CNY,M,A,912,2001M9 +,CNY,M,A,1120,2001M10 +,CNY,M,A,1121,2001M11 +,CNY,M,A,1122,2001M12 +,CNY,M,A,112,2002M1 +,CNY,M,A,212,2002M2 +,CNY,M,A,312,2002M3 +,CNY,M,A,412,2002M4 +,CNY,M,A,512,2002M5 +,CNY,M,A,612,2002M6 +,CNY,M,A,712,2002M7 +,CNY,M,A,812,2002M8 +,CNY,M,A,912,2002M9 +,CNY,M,A,1120,2002M10 +,CNY,M,A,1121,2002M11 +,CNY,M,A,1122,2002M12 +,CNY,M,A,112,2003M1 +,CNY,M,A,212,2003M2 +,CNY,M,A,312,2003M3 +,CNY,M,A,412,2003M4 +,CNY,M,A,512,2003M5 +,CNY,M,A,612,2003M6 +,CNY,M,A,712,2003M7 +,CNY,M,A,812,2003M8 +,CNY,M,A,912,2003M9 +,CNY,M,A,1120,2003M10 +,CNY,M,A,1121,2003M11 +,CNY,M,A,1122,2003M12 \ No newline at end of file diff --git a/tests/TimePeriod/data/DataSet/output/1-1.csv b/tests/TimePeriod/data/DataSet/output/1-1.csv new file mode 100644 index 00000000..b26d53ce --- /dev/null +++ b/tests/TimePeriod/data/DataSet/output/1-1.csv @@ -0,0 +1,2 @@ +CONF_STATUS,EXR_CURRENCY,FREQ,OBS_STATUS,OBS_VALUE,TIME_PERIOD +,CNY,M,A,112,2002M1 \ No newline at end of file diff --git a/tests/TimePeriod/data/DataSet/output/2-1.csv b/tests/TimePeriod/data/DataSet/output/2-1.csv new file mode 100644 index 00000000..d98eb786 --- /dev/null +++ b/tests/TimePeriod/data/DataSet/output/2-1.csv @@ -0,0 +1,49 @@ +CONF_STATUS,EXR_CURRENCY,FREQ,OBS_STATUS,OBS_VALUE,TIME_PERIOD +,01,M,,112,2000M1 +,02,M,,212,2000M2 +,03,M,A,312,2000M3 +,04,M,A,412,2000M4 +,05,M,A,512,2000M5 +,CNY,M,A,612,2000M6 +,CNY,M,A,712,2000M7 +,CNY,M,A,812,2000M8 +,CNY,M,A,912,2000M9 +,CNY,M,A,1120,2000M10 +,CNY,M,A,1121,2000M11 +,CNY,M,A,1122,2000M12 +,CNY,M,A,112,2001M1 +,CNY,M,A,212,2001M2 +,CNY,M,A,312,2001M3 +,CNY,M,A,412,2001M4 +,CNY,M,A,512,2001M5 +,CNY,M,A,612,2001M6 +,CNY,M,A,712,2001M7 +,CNY,M,A,812,2001M8 +,CNY,M,A,912,2001M9 +,CNY,M,A,1120,2001M10 +,CNY,M,A,1121,2001M11 +,CNY,M,A,1122,2001M12 +,CNY,M,A,112,2002M1 +,CNY,M,A,212,2002M2 +,CNY,M,A,312,2002M3 +,CNY,M,A,412,2002M4 +,CNY,M,A,512,2002M5 +,CNY,M,A,612,2002M6 +,CNY,M,A,712,2002M7 +,CNY,M,A,812,2002M8 +,CNY,M,A,912,2002M9 +,CNY,M,A,1120,2002M10 +,CNY,M,A,1121,2002M11 +,CNY,M,A,1122,2002M12 +,CNY,M,A,112,2003M1 +,CNY,M,A,212,2003M2 +,CNY,M,A,312,2003M3 +,CNY,M,A,412,2003M4 +,CNY,M,A,512,2003M5 +,CNY,M,A,612,2003M6 +,CNY,M,A,712,2003M7 +,CNY,M,A,812,2003M8 +,CNY,M,A,912,2003M9 +,CNY,M,A,1120,2003M10 +,CNY,M,A,1121,2003M11 +,CNY,M,A,1122,2003M12 \ No newline at end of file diff --git a/tests/TimePeriod/data/DataSet/output/3-1.csv b/tests/TimePeriod/data/DataSet/output/3-1.csv new file mode 100644 index 00000000..e01c86f7 --- /dev/null +++ b/tests/TimePeriod/data/DataSet/output/3-1.csv @@ -0,0 +1,32 @@ +CONF_STATUS,EXR_CURRENCY,FREQ,OBS_STATUS,OBS_VALUE,TIME_PERIOD +,01,M,,112,2000M1 +,02,M,,212,2000M2 +,03,M,A,312,2000M3 +,04,M,A,412,2000M4 +,05,M,A,512,2000M5 +,CNY,M,A,612,2000M6 +,CNY,M,A,712,2000M7 +,CNY,M,A,812,2000M8 +,CNY,M,A,912,2000M9 +,CNY,M,A,1120,2000M10 +,CNY,M,A,1121,2000M11 +,CNY,M,A,1122,2000M12 +,CNY,M,A,112,2001M1 +,CNY,M,A,212,2001M2 +,CNY,M,A,312,2001M3 +,CNY,M,A,412,2001M4 +,CNY,M,A,512,2001M5 +,CNY,M,A,612,2001M6 +,CNY,M,A,712,2001M7 +,CNY,M,A,812,2001M8 +,CNY,M,A,912,2001M9 +,CNY,M,A,1120,2001M10 +,CNY,M,A,1121,2001M11 +,CNY,M,A,1122,2001M12 +,CNY,M,A,112,2002M1 +,CNY,M,A,212,2002M2 +,CNY,M,A,312,2002M3 +,CNY,M,A,412,2002M4 +,CNY,M,A,512,2002M5 +,CNY,M,A,612,2002M6 +,CNY,M,A,712,2002M7 diff --git a/tests/TimePeriod/data/DataSet/output/4-1.csv b/tests/TimePeriod/data/DataSet/output/4-1.csv new file mode 100644 index 00000000..00d1a8c1 --- /dev/null +++ b/tests/TimePeriod/data/DataSet/output/4-1.csv @@ -0,0 +1,24 @@ +CONF_STATUS,EXR_CURRENCY,FREQ,OBS_STATUS,OBS_VALUE,TIME_PERIOD +,CNY,M,A,212,2002M2 +,CNY,M,A,312,2002M3 +,CNY,M,A,412,2002M4 +,CNY,M,A,512,2002M5 +,CNY,M,A,612,2002M6 +,CNY,M,A,712,2002M7 +,CNY,M,A,812,2002M8 +,CNY,M,A,912,2002M9 +,CNY,M,A,1120,2002M10 +,CNY,M,A,1121,2002M11 +,CNY,M,A,1122,2002M12 +,CNY,M,A,112,2003M1 +,CNY,M,A,212,2003M2 +,CNY,M,A,312,2003M3 +,CNY,M,A,412,2003M4 +,CNY,M,A,512,2003M5 +,CNY,M,A,612,2003M6 +,CNY,M,A,712,2003M7 +,CNY,M,A,812,2003M8 +,CNY,M,A,912,2003M9 +,CNY,M,A,1120,2003M10 +,CNY,M,A,1121,2003M11 +,CNY,M,A,1122,2003M12 \ No newline at end of file diff --git a/tests/TimePeriod/data/DataSet/output/5-1.csv b/tests/TimePeriod/data/DataSet/output/5-1.csv new file mode 100644 index 00000000..e01c86f7 --- /dev/null +++ b/tests/TimePeriod/data/DataSet/output/5-1.csv @@ -0,0 +1,32 @@ +CONF_STATUS,EXR_CURRENCY,FREQ,OBS_STATUS,OBS_VALUE,TIME_PERIOD +,01,M,,112,2000M1 +,02,M,,212,2000M2 +,03,M,A,312,2000M3 +,04,M,A,412,2000M4 +,05,M,A,512,2000M5 +,CNY,M,A,612,2000M6 +,CNY,M,A,712,2000M7 +,CNY,M,A,812,2000M8 +,CNY,M,A,912,2000M9 +,CNY,M,A,1120,2000M10 +,CNY,M,A,1121,2000M11 +,CNY,M,A,1122,2000M12 +,CNY,M,A,112,2001M1 +,CNY,M,A,212,2001M2 +,CNY,M,A,312,2001M3 +,CNY,M,A,412,2001M4 +,CNY,M,A,512,2001M5 +,CNY,M,A,612,2001M6 +,CNY,M,A,712,2001M7 +,CNY,M,A,812,2001M8 +,CNY,M,A,912,2001M9 +,CNY,M,A,1120,2001M10 +,CNY,M,A,1121,2001M11 +,CNY,M,A,1122,2001M12 +,CNY,M,A,112,2002M1 +,CNY,M,A,212,2002M2 +,CNY,M,A,312,2002M3 +,CNY,M,A,412,2002M4 +,CNY,M,A,512,2002M5 +,CNY,M,A,612,2002M6 +,CNY,M,A,712,2002M7 diff --git a/tests/TimePeriod/data/DataSet/output/6-1.csv b/tests/TimePeriod/data/DataSet/output/6-1.csv new file mode 100644 index 00000000..de0f75b4 --- /dev/null +++ b/tests/TimePeriod/data/DataSet/output/6-1.csv @@ -0,0 +1,20 @@ +CONF_STATUS,EXR_CURRENCY,FREQ,OBS_STATUS,OBS_VALUE,TIME_PERIOD +,CNY,M,A,612,2002M6 +,CNY,M,A,712,2002M7 +,CNY,M,A,812,2002M8 +,CNY,M,A,912,2002M9 +,CNY,M,A,1120,2002M10 +,CNY,M,A,1121,2002M11 +,CNY,M,A,1122,2002M12 +,CNY,M,A,112,2003M1 +,CNY,M,A,212,2003M2 +,CNY,M,A,312,2003M3 +,CNY,M,A,412,2003M4 +,CNY,M,A,512,2003M5 +,CNY,M,A,612,2003M6 +,CNY,M,A,712,2003M7 +,CNY,M,A,812,2003M8 +,CNY,M,A,912,2003M9 +,CNY,M,A,1120,2003M10 +,CNY,M,A,1121,2003M11 +,CNY,M,A,1122,2003M12 \ No newline at end of file diff --git a/tests/TimePeriod/data/DataSet/output/GL_416-1.csv b/tests/TimePeriod/data/DataSet/output/GL_416-1.csv index 707ac6cb..ca3b0e4d 100644 --- a/tests/TimePeriod/data/DataSet/output/GL_416-1.csv +++ b/tests/TimePeriod/data/DataSet/output/GL_416-1.csv @@ -1,145 +1,5 @@ DATAFLOW,FREQ,NBB_COICOP,INDEX_BASE,INDEX_TYPE,DERIVATION,REF_AREA,ADJUSTMENT,INSTITUTION,TIME_PERIOD,OBS_VALUE,OBS_STATUS,CONF_STATUS,UNIT_MEASURE,UNIT_MULT,EMBARGO_TIME,DECIMALS BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2020-M01,108.53,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2020-M02,109.26,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2020-M03,110.52,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2020-M04,112.25,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2020-M05,112.06,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2020-M06,111.5,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2020-M07,111.73,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2020-M08,111.77,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2020-M09,110.21,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2020-M10,110.52,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2020-M11,109.43,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2020-M12,108.89,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2021-M01,109.88,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2021-M02,109.03,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2021-M03,109.88,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2021-M04,110.91,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2021-M05,110.29,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2021-M06,110.13,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2021-M07,110.76,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2021-M08,111.39,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2021-M09,109.13,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2021-M10,110.17,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2021-M11,109.69,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2021-M12,110.18,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2022-M01,112.49,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2022-M02,113.34,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2022-M03,115.18,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2022-M04,116.79,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2022-M05,117.59,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2022-M06,119.62,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2022-M07,121.52,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2022-M08,122.7,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2022-M09,120.86,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2022-M10,124.4,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2022-M11,126.29,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,1,2013,NCP,INDICES,BE,_Z,BE1,2022-M12,126.88,A,F,IX,0,,2 BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2020-M01,126.68,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2020-M02,129.27,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2020-M03,128.71,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2020-M04,131.83,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2020-M05,132.78,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2020-M06,128.7,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2020-M07,129.32,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2020-M08,130.75,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2020-M09,131.6,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2020-M10,128.66,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2020-M11,130.62,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2020-M12,128.76,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2021-M01,128.95,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2021-M02,133.39,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2021-M03,132.21,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2021-M04,133.92,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2021-M05,136.3,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2021-M06,131.04,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2021-M07,131.94,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2021-M08,134.79,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2021-M09,138.48,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2021-M10,132.94,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2021-M11,136.97,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2021-M12,133.96,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2022-M01,133.67,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2022-M02,138.04,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2022-M03,136.2,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2022-M04,137.97,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2022-M05,140.97,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2022-M06,138.95,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2022-M07,138.21,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2022-M08,142.17,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2022-M09,148.04,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2022-M10,141.14,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2022-M11,147.45,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,2,2013,NCP,INDICES,BE,_Z,BE1,2022-M12,144.31,A,F,IX,0,,2 BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2020-M01,105.13,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2020-M02,104.59,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2020-M03,104.67,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2020-M04,104.54,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2020-M05,104.57,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2020-M06,104.64,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2020-M07,104.55,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2020-M08,104.69,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2020-M09,104.98,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2020-M10,105.03,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2020-M11,105.03,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2020-M12,104.69,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2021-M01,104.69,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2021-M02,104.69,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2021-M03,104.92,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2021-M04,104.96,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2021-M05,105.05,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2021-M06,105.05,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2021-M07,105.06,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2021-M08,104.99,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2021-M09,105.21,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2021-M10,105.33,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2021-M11,105.45,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2021-M12,105.54,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2022-M01,105.54,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2022-M02,105.96,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2022-M03,106.11,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2022-M04,104.96,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2022-M05,104.36,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2022-M06,103.64,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2022-M07,103.66,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2022-M08,105.07,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2022-M09,108.38,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2022-M10,109.98,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2022-M11,112.01,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,3,2013,NCP,INDICES,BE,_Z,BE1,2022-M12,112.82,A,F,IX,0,,2 BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2020-M01,109.28,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2020-M02,108.62,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2020-M03,108.4,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2020-M04,107.45,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2020-M05,107.03,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2020-M06,107.02,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2020-M07,106.52,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2020-M08,106.57,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2020-M09,106.53,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2020-M10,107.53,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2020-M11,107.38,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2020-M12,107.37,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2021-M01,107.85,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2021-M02,108.43,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2021-M03,108.94,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2021-M04,109.07,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2021-M05,109.7,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2021-M06,110.94,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2021-M07,112.55,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2021-M08,114.14,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2021-M09,114.73,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2021-M10,120.6,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2021-M11,127.38,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2021-M12,126.92,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2022-M01,136.93,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2022-M02,137.97,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2022-M03,135.98,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2022-M04,135.48,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2022-M05,137.03,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2022-M06,137.16,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2022-M07,138.09,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2022-M08,142.61,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2022-M09,150.88,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2022-M10,161.49,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2022-M11,154.01,A,F,IX,0,,2 -BE2:DF_NICP(1.0),M,4,2013,NCP,INDICES,BE,_Z,BE1,2022-M12,152.96,A,F,IX,0,,2 diff --git a/tests/TimePeriod/data/DataStructure/input/1-1.json b/tests/TimePeriod/data/DataStructure/input/1-1.json new file mode 100644 index 00000000..db8e5231 --- /dev/null +++ b/tests/TimePeriod/data/DataStructure/input/1-1.json @@ -0,0 +1,45 @@ +{ + "datasets": [ + { + "name": "DSD_EXR", + "DataStructure": [ + { + "name": "CONF_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "EXR_CURRENCY", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "FREQ", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "OBS_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "OBS_VALUE", + "type": "Number", + "nullable": true, + "role": "Measure" + }, + { + "name": "TIME_PERIOD", + "type": "Time_Period", + "nullable": false, + "role": "Identifier" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/TimePeriod/data/DataStructure/input/2-1.json b/tests/TimePeriod/data/DataStructure/input/2-1.json new file mode 100644 index 00000000..db8e5231 --- /dev/null +++ b/tests/TimePeriod/data/DataStructure/input/2-1.json @@ -0,0 +1,45 @@ +{ + "datasets": [ + { + "name": "DSD_EXR", + "DataStructure": [ + { + "name": "CONF_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "EXR_CURRENCY", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "FREQ", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "OBS_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "OBS_VALUE", + "type": "Number", + "nullable": true, + "role": "Measure" + }, + { + "name": "TIME_PERIOD", + "type": "Time_Period", + "nullable": false, + "role": "Identifier" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/TimePeriod/data/DataStructure/input/3-1.json b/tests/TimePeriod/data/DataStructure/input/3-1.json new file mode 100644 index 00000000..db8e5231 --- /dev/null +++ b/tests/TimePeriod/data/DataStructure/input/3-1.json @@ -0,0 +1,45 @@ +{ + "datasets": [ + { + "name": "DSD_EXR", + "DataStructure": [ + { + "name": "CONF_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "EXR_CURRENCY", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "FREQ", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "OBS_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "OBS_VALUE", + "type": "Number", + "nullable": true, + "role": "Measure" + }, + { + "name": "TIME_PERIOD", + "type": "Time_Period", + "nullable": false, + "role": "Identifier" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/TimePeriod/data/DataStructure/input/4-1.json b/tests/TimePeriod/data/DataStructure/input/4-1.json new file mode 100644 index 00000000..db8e5231 --- /dev/null +++ b/tests/TimePeriod/data/DataStructure/input/4-1.json @@ -0,0 +1,45 @@ +{ + "datasets": [ + { + "name": "DSD_EXR", + "DataStructure": [ + { + "name": "CONF_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "EXR_CURRENCY", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "FREQ", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "OBS_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "OBS_VALUE", + "type": "Number", + "nullable": true, + "role": "Measure" + }, + { + "name": "TIME_PERIOD", + "type": "Time_Period", + "nullable": false, + "role": "Identifier" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/TimePeriod/data/DataStructure/input/5-1.json b/tests/TimePeriod/data/DataStructure/input/5-1.json new file mode 100644 index 00000000..db8e5231 --- /dev/null +++ b/tests/TimePeriod/data/DataStructure/input/5-1.json @@ -0,0 +1,45 @@ +{ + "datasets": [ + { + "name": "DSD_EXR", + "DataStructure": [ + { + "name": "CONF_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "EXR_CURRENCY", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "FREQ", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "OBS_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "OBS_VALUE", + "type": "Number", + "nullable": true, + "role": "Measure" + }, + { + "name": "TIME_PERIOD", + "type": "Time_Period", + "nullable": false, + "role": "Identifier" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/TimePeriod/data/DataStructure/input/6-1.json b/tests/TimePeriod/data/DataStructure/input/6-1.json new file mode 100644 index 00000000..db8e5231 --- /dev/null +++ b/tests/TimePeriod/data/DataStructure/input/6-1.json @@ -0,0 +1,45 @@ +{ + "datasets": [ + { + "name": "DSD_EXR", + "DataStructure": [ + { + "name": "CONF_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "EXR_CURRENCY", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "FREQ", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "OBS_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "OBS_VALUE", + "type": "Number", + "nullable": true, + "role": "Measure" + }, + { + "name": "TIME_PERIOD", + "type": "Time_Period", + "nullable": false, + "role": "Identifier" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/TimePeriod/data/DataStructure/output/1-1.json b/tests/TimePeriod/data/DataStructure/output/1-1.json new file mode 100644 index 00000000..7ac6c8fa --- /dev/null +++ b/tests/TimePeriod/data/DataStructure/output/1-1.json @@ -0,0 +1,45 @@ +{ + "datasets": [ + { + "name": "DS_r", + "DataStructure": [ + { + "name": "CONF_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "EXR_CURRENCY", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "FREQ", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "OBS_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "OBS_VALUE", + "type": "Number", + "nullable": true, + "role": "Measure" + }, + { + "name": "TIME_PERIOD", + "type": "Time_Period", + "nullable": false, + "role": "Identifier" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/TimePeriod/data/DataStructure/output/2-1.json b/tests/TimePeriod/data/DataStructure/output/2-1.json new file mode 100644 index 00000000..7ac6c8fa --- /dev/null +++ b/tests/TimePeriod/data/DataStructure/output/2-1.json @@ -0,0 +1,45 @@ +{ + "datasets": [ + { + "name": "DS_r", + "DataStructure": [ + { + "name": "CONF_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "EXR_CURRENCY", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "FREQ", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "OBS_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "OBS_VALUE", + "type": "Number", + "nullable": true, + "role": "Measure" + }, + { + "name": "TIME_PERIOD", + "type": "Time_Period", + "nullable": false, + "role": "Identifier" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/TimePeriod/data/DataStructure/output/3-1.json b/tests/TimePeriod/data/DataStructure/output/3-1.json new file mode 100644 index 00000000..7ac6c8fa --- /dev/null +++ b/tests/TimePeriod/data/DataStructure/output/3-1.json @@ -0,0 +1,45 @@ +{ + "datasets": [ + { + "name": "DS_r", + "DataStructure": [ + { + "name": "CONF_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "EXR_CURRENCY", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "FREQ", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "OBS_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "OBS_VALUE", + "type": "Number", + "nullable": true, + "role": "Measure" + }, + { + "name": "TIME_PERIOD", + "type": "Time_Period", + "nullable": false, + "role": "Identifier" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/TimePeriod/data/DataStructure/output/4-1.json b/tests/TimePeriod/data/DataStructure/output/4-1.json new file mode 100644 index 00000000..7ac6c8fa --- /dev/null +++ b/tests/TimePeriod/data/DataStructure/output/4-1.json @@ -0,0 +1,45 @@ +{ + "datasets": [ + { + "name": "DS_r", + "DataStructure": [ + { + "name": "CONF_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "EXR_CURRENCY", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "FREQ", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "OBS_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "OBS_VALUE", + "type": "Number", + "nullable": true, + "role": "Measure" + }, + { + "name": "TIME_PERIOD", + "type": "Time_Period", + "nullable": false, + "role": "Identifier" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/TimePeriod/data/DataStructure/output/5-1.json b/tests/TimePeriod/data/DataStructure/output/5-1.json new file mode 100644 index 00000000..7ac6c8fa --- /dev/null +++ b/tests/TimePeriod/data/DataStructure/output/5-1.json @@ -0,0 +1,45 @@ +{ + "datasets": [ + { + "name": "DS_r", + "DataStructure": [ + { + "name": "CONF_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "EXR_CURRENCY", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "FREQ", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "OBS_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "OBS_VALUE", + "type": "Number", + "nullable": true, + "role": "Measure" + }, + { + "name": "TIME_PERIOD", + "type": "Time_Period", + "nullable": false, + "role": "Identifier" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/TimePeriod/data/DataStructure/output/6-1.json b/tests/TimePeriod/data/DataStructure/output/6-1.json new file mode 100644 index 00000000..7ac6c8fa --- /dev/null +++ b/tests/TimePeriod/data/DataStructure/output/6-1.json @@ -0,0 +1,45 @@ +{ + "datasets": [ + { + "name": "DS_r", + "DataStructure": [ + { + "name": "CONF_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "EXR_CURRENCY", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "FREQ", + "type": "String", + "nullable": false, + "role": "Identifier" + }, + { + "name": "OBS_STATUS", + "type": "String", + "nullable": true, + "role": "Attribute" + }, + { + "name": "OBS_VALUE", + "type": "Number", + "nullable": true, + "role": "Measure" + }, + { + "name": "TIME_PERIOD", + "type": "Time_Period", + "nullable": false, + "role": "Identifier" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/TimePeriod/data/vtl/1.vtl b/tests/TimePeriod/data/vtl/1.vtl new file mode 100644 index 00000000..e69de29b diff --git a/tests/TimePeriod/data/vtl/2.vtl b/tests/TimePeriod/data/vtl/2.vtl new file mode 100644 index 00000000..ba98c7c4 --- /dev/null +++ b/tests/TimePeriod/data/vtl/2.vtl @@ -0,0 +1 @@ +DS_r := DSD_EXR[filter TIME_PERIOD = cast("2002M1", time_period)]; \ No newline at end of file diff --git a/tests/TimePeriod/data/vtl/3.vtl b/tests/TimePeriod/data/vtl/3.vtl new file mode 100644 index 00000000..e69de29b diff --git a/tests/TimePeriod/data/vtl/4.vtl b/tests/TimePeriod/data/vtl/4.vtl new file mode 100644 index 00000000..e69de29b diff --git a/tests/TimePeriod/data/vtl/5.vtl b/tests/TimePeriod/data/vtl/5.vtl new file mode 100644 index 00000000..e69de29b diff --git a/tests/TimePeriod/test_timeperiod.py b/tests/TimePeriod/test_timeperiod.py index d32fe26e..772a7a4e 100644 --- a/tests/TimePeriod/test_timeperiod.py +++ b/tests/TimePeriod/test_timeperiod.py @@ -1,163 +1,67 @@ +import warnings from pathlib import Path -from tests.Helper import TestHelper - - -class TimePeriodHelper(TestHelper): - base_path = Path(__file__).parent - filepath_VTL = base_path / "data" / "vtl" - filepath_valueDomain = base_path / "data" / "ValueDomain" - filepath_json = base_path / "data" / "DataStructure" / "input" - filepath_csv = base_path / "data" / "DataSet" / "input" - filepath_out_json = base_path / "data" / "DataStructure" / "output" - filepath_out_csv = base_path / "data" / "DataSet" / "output" - filepath_sql = base_path / "data" / "sql" - - -class TimePeriodTest(TimePeriodHelper): - """ - Group 1 - """ - - classTest = "timePeriodtests.TimePeriodTest" - - def test_GL_416(self): - """ - test2_1 := BE2_DF_NICP[filter FREQ = "M" and TIME_PERIOD = cast("2020-01", time_period)]; - """ - code = "GL_416" - number_inputs = 1 - references_names = ["1"] - - self.BaseTest(code=code, number_inputs=number_inputs, references_names=references_names) - - def test_GL_418(self): - """ """ - code = "GL_418" - number_inputs = 1 - references_names = ["1", "2", "3"] - - self.BaseTest(code=code, number_inputs=number_inputs, references_names=references_names) - - def test_GL_417_1(self): - """ - Test := avg (BE2_DF_NICP group all time_agg ("Q", "M", TIME_PERIOD)); - """ - code = "GL_417_1" - number_inputs = 1 - references_names = ["1"] - - self.BaseTest(code=code, number_inputs=number_inputs, references_names=references_names) - - def test_GL_417_2(self): - """ - Test := avg (BE2_DF_NICP group all time_agg ("A", "M", TIME_PERIOD)); - """ - code = "GL_417_2" - number_inputs = 1 - references_names = ["1"] - - self.BaseTest(code=code, number_inputs=number_inputs, references_names=references_names) - - def test_GL_417_3(self): - """ """ - code = "GL_417_3" - number_inputs = 1 - error_code = "1-1-19-4" - - self.NewSemanticExceptionTest( - code=code, number_inputs=number_inputs, exception_code=error_code - ) - - def test_GL_417_4( - self, - ): # TODO: Check periodIndFrom is not the same as in data, in data is "M", should we allow this? - """ - Test := avg (BE2_DF_NICP group all time_agg ("A", "Q", TIME_PERIOD)); - """ - code = "GL_417_4" - number_inputs = 1 - references_names = ["1"] - - self.BaseTest(code=code, number_inputs=number_inputs, references_names=references_names) - - def test_GL_421_1(self): - """ - test2_1 := BE2_DF_NICP - [calc FREQ_2 := TIME_PERIOD in {cast("2020-01", time_period), cast("2021-01", time_period)}]; - """ - code = "GL_421_1" - number_inputs = 1 - references_names = ["1"] - - self.BaseTest(code=code, number_inputs=number_inputs, references_names=references_names) - - def test_GL_421_2(self): - """ """ - # code = "GL_421_2" - # number_inputs = 1 - # error_code = "1-3-10" - - # Deactivated test due to Set declaration (need more information) - - # self.NewSemanticExceptionTest(code=code, number_inputs=number_inputs, exception_code=error_code) - - def test_GL_440_1(self): - """ - DS_r := DS_1 ; - """ - code = "GL_440_1" - number_inputs = 1 - references_names = ["1"] - - self.BaseTest(code=code, number_inputs=number_inputs, references_names=references_names) - - def test_GL_440_2(self): - """ """ - code = "GL_440_2" - number_inputs = 1 - message = "0-1-1-12" - - self.DataLoadExceptionTest(code=code, number_inputs=number_inputs, exception_code=message) - - ############# - # Tests for the sdmx external representation - def test_GL_462_1(self): - """ - DS_r := DS_1 ; - """ - code = "GL_462_1" - number_inputs = 1 - references_names = ["1"] - - self.BaseTest(code=code, number_inputs=number_inputs, references_names=references_names) - - def test_GL_462_2(self): - """ """ - code = "GL_462_2" - number_inputs = 2 - references_names = ["1", "2"] - - self.BaseTest(code=code, number_inputs=number_inputs, references_names=references_names) - - def test_GL_462_3(self): - """ - Status: OK - Description: Over scalardataset - Goal: Check Result. - """ - code = "GL_462_3" - number_inputs = 1 - references_names = ["1"] - - self.BaseTest(code=code, number_inputs=number_inputs, references_names=references_names) - - def test_GL_462_4(self): - """ - Test for null value - """ - code = "GL_462_4" - number_inputs = 1 - references_names = ["1"] - - self.BaseTest(code=code, number_inputs=number_inputs, references_names=references_names) +import pytest +from pytest import mark + +from vtlengine.API import create_ast +from vtlengine.Interpreter import InterpreterAnalyzer + +pytestmark = mark.input_path(Path(__file__).parent / "data") + + +ds_param = [ + ("1", 'DS_r := DSD_EXR[filter TIME_PERIOD = cast("2002M1", time_period)];'), + ("2", 'DS_r := DSD_EXR[filter TIME_PERIOD <> cast("2002Q1", time_period)];'), + ("3", 'DS_r := DSD_EXR[filter TIME_PERIOD < cast("2002S2", time_period)];'), + ("4", 'DS_r := DSD_EXR[filter TIME_PERIOD > cast("2002M1", time_period)];'), + ("5", 'DS_r := DSD_EXR[filter TIME_PERIOD <= cast("2002Q3", time_period)];'), + ("6", 'DS_r := DSD_EXR[filter TIME_PERIOD >= cast("2002W26", time_period)];'), + ( + "GL_416", + 'test2_1 := BE2_DF_NICP[filter FREQ = "M" and TIME_PERIOD = cast("2020-01", time_period)];', + ), + ("GL_417_1", 'test := avg (BE2_DF_NICP group all time_agg ("Q", "M", TIME_PERIOD));'), + ("GL_417_2", 'test := avg (BE2_DF_NICP group all time_agg ("A", "M", TIME_PERIOD));'), + ("GL_417_4", 'test := avg (BE2_DF_NICP group all time_agg ("A", "Q", TIME_PERIOD));'), + ( + "GL_418", + 'test2_1 := BE2_DF_NICP[sub DERIVATION = "INDICES"][filter FREQ = "M"][keep OBS_VALUE]; \ + test2_2 := timeshift(test2_1,-12); \ + test2_result <- inner_join(test2_1[rename OBS_VALUE to CURRENT] as C, test2_2 \ + [rename OBS_VALUE to PREVIOUS] as P calc GROWTH :=(CURRENT - PREVIOUS) / PREVIOUS * 100, \ + identifier DERIVATION := "GROWTH_RATE");', + ), + ( + "GL_421_1", + 'test2_1 := BE2_DF_NICP[calc FREQ_2 := TIME_PERIOD in {cast("2020-01", time_period), cast("2021-01", time_period)}];', + ), + # ("GL_421_2", 'test := avg (BE2_DF_NICP group all time_agg ("A", "M", TIME_PERIOD));'), + ("GL_440_1", "DS_r := DS_1;"), + ("GL_462_1", "added := demo_data_structure;"), + ("GL_462_2", "added := demo_data_structure; DS_r := added+ ds_2;"), + ("GL_462_3", "sc_result := sc_1;"), + ("GL_462_4", "DS_r := ds_2;"), +] + +error_param = [ + ("GL_440_2", "DS_r := DS_1;", "0-1-1-12"), +] + + +@pytest.mark.parametrize("code, expression", ds_param) +def test_case_ds(load_input, load_reference, code, expression): + warnings.filterwarnings("ignore", category=FutureWarning) + ast = create_ast(expression) + interpreter = InterpreterAnalyzer(load_input) + result = interpreter.visit(ast) + assert result == load_reference + + +@pytest.mark.parametrize("code, expression, error_code", error_param) +def test_errors(load_error, code, expression, error_code): + warnings.filterwarnings("ignore", category=FutureWarning) + result = error_code == load_error + if result is False: + print(f"\n{error_code} != {load_error}") + assert result