-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
45 check time period comparison (#46)
* 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 <javier.hernandez@meaningfuldata.eu>
- Loading branch information
1 parent
a611217
commit 699c2c3
Showing
40 changed files
with
1,156 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ] ; | ||
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 ] ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.