diff --git a/features/01.create_timeserie.feature b/features/01.create_timeserie.feature index b162455..e5c9b6e 100644 --- a/features/01.create_timeserie.feature +++ b/features/01.create_timeserie.feature @@ -14,4 +14,14 @@ Value Statement: Then I have a time series with the `correct` number of rows and columns, schema and time interval And I have a CSV file in T8S_WORKSPACE/data/csv correctelly formated And I have a Parquet file in T8S_WORKSPACE/data/parquet correctelly formated with metadata annotations + And I have a text representation for the first time serie like this: + """ + TimeSerie(format=wide, features=3, df= + timestamp temperatura velocidade + 0 2022-01-01 00:00:00 25.000000 3000.0 + 1 2022-01-01 01:00:00 26.000000 1100.0 + 2 2022-01-01 02:00:00 27.000000 1200.0 + 3 2022-01-01 03:00:00 23.200001 4000.0) + + types: [, , ] + """ # Constraint: The first Dataframe doesn't have nulls or invalid values, but the second does diff --git a/features/steps/01.create_timeserie_steps.py b/features/steps/01.create_timeserie_steps.py index 60a86a4..99e1843 100644 --- a/features/steps/01.create_timeserie_steps.py +++ b/features/steps/01.create_timeserie_steps.py @@ -134,3 +134,17 @@ def write_ts_to_parquet_file(ts, parquet_path, filename: str): # Grava a série temporal ts2 em parquet # write_ts_to_parquet_file(context.ts2, context.PARQUET_PATH, 'ts_02.parquet') + +@then(u'I have a text representation for the first time serie like this:') +def check_text(context): + logger.debug(f'check_text : context.text -> \n{str(context.text)}') + logger.debug(f'\ncheck_text : context.ts1 -> \n{str(context.ts1)}') + def assert_line_by_line(context): + ts1_line = str(context.ts1).splitlines() + for idx, line in enumerate(context.text.splitlines()): + logger.info(f'check_text : line {idx} -> \n"{line}" == "{ts1_line[idx]}"') + msg =f'context.text must be equal to str(ts1). Failed in line {idx} -> "{line}" != "{ts1_line[idx]}"' + assert line.strip() == ts1_line[idx].strip(), msg + assert_line_by_line(context) + logger.info('\ncheck_text passed !') + diff --git a/pyproject.toml b/pyproject.toml index 33dd487..8bb7021 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,8 @@ dependencies = [ "pyyaml", "pyarrow", "pandas", + "behave", + "behave-pandas" ] [project.optional-dependencies] @@ -89,7 +91,7 @@ cov = [ ] [[tool.hatch.envs.all.matrix]] -python = ["3.10", "3.11"] +python = ["3.11"] [tool.hatch.envs.lint] detached = true