Skip to content

Commit

Permalink
fix parser tests for datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
edulauer committed Aug 9, 2024
1 parent a4b1c92 commit 8972c96
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions tests/parsers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
import inspect
import textwrap

import yaml
import pytest

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
Expand All @@ -14,19 +14,6 @@
from dou_dag_generator import DouDigestDagGenerator, YAMLParser, DAGConfig


@pytest.mark.parametrize(
"dag_id, size, hashed",
[
("unique_id_for_each_dag", 60, 56),
("generates_sparses_hashed_results", 120, 59),
("unique_id_for_each_dag", 10, 6),
("", 10, 0),
("", 100, 0),
],
)
def test_hash_dag_id(yaml_parser, dag_id, size, hashed):
assert yaml_parser._hash_dag_id(dag_id, size) == hashed


@pytest.mark.parametrize(
"filepath, result_tuple",
Expand Down Expand Up @@ -63,7 +50,8 @@ def test_hash_dag_id(yaml_parser, dag_id, size, hashed):
"attach_csv": False,
"discord_webhook": None,
"slack_webhook": None,
"schedule": "37 5 * * *",
"schedule": None,
"dataset": None,
"description": "DAG de teste",
"skip_null": True,
"doc_md": None,
Expand Down Expand Up @@ -108,6 +96,7 @@ def test_hash_dag_id(yaml_parser, dag_id, size, hashed):
"discord_webhook": None,
"slack_webhook": None,
"schedule": "0 8 * * MON-FRI",
"dataset": None,
"description": "DAG exemplo utilizando todos os demais parâmetros.",
"skip_null": True,
"doc_md": None,
Expand Down Expand Up @@ -154,7 +143,8 @@ def test_hash_dag_id(yaml_parser, dag_id, size, hashed):
"attach_csv": True,
"discord_webhook": None,
"slack_webhook": None,
"schedule": "2 5 * * *",
"schedule": None,
"dataset": None,
"description": "DAG de teste",
"skip_null": True,
"doc_md": None,
Expand Down Expand Up @@ -194,7 +184,8 @@ def test_hash_dag_id(yaml_parser, dag_id, size, hashed):
"attach_csv": False,
"discord_webhook": None,
"slack_webhook": None,
"schedule": "29 5 * * *",
"schedule": None,
"dataset": None,
"description": "DAG de teste",
"skip_null": False,
"doc_md": None,
Expand Down Expand Up @@ -238,7 +229,8 @@ def test_hash_dag_id(yaml_parser, dag_id, size, hashed):
"attach_csv": False,
"discord_webhook": None,
"slack_webhook": None,
"schedule": "10 5 * * *",
"schedule": None,
"dataset": None,
"description": "DAG com documentação em markdown",
"skip_null": True,
"doc_md": textwrap.dedent(
Expand Down Expand Up @@ -289,7 +281,8 @@ def test_hash_dag_id(yaml_parser, dag_id, size, hashed):
"attach_csv": False,
"discord_webhook": None,
"slack_webhook": None,
"schedule": "59 5 * * *",
"schedule": None,
"dataset": None,
"description": "DAG de teste (filtro por departamento)",
"skip_null": True,
"doc_md": None,
Expand Down Expand Up @@ -330,6 +323,7 @@ def test_hash_dag_id(yaml_parser, dag_id, size, hashed):
"discord_webhook": None,
"slack_webhook": None,
"schedule": "0 8 * * MON-FRI",
"dataset": "inlabs",
"description": "DAG de teste",
"skip_null": True,
"doc_md": None,
Expand Down Expand Up @@ -372,7 +366,8 @@ def test_hash_dag_id(yaml_parser, dag_id, size, hashed):
"attach_csv": True,
"discord_webhook": None,
"slack_webhook": None,
"schedule": "0 8 * * MON-FRI",
"schedule": None,
"dataset": "inlabs",
"description": "DAG de teste",
"skip_null": True,
"doc_md": None,
Expand Down Expand Up @@ -438,6 +433,7 @@ def test_hash_dag_id(yaml_parser, dag_id, size, hashed):
"discord_webhook": None,
"slack_webhook": None,
"schedule": "0 8 * * MON-FRI",
"dataset": None,
"description": "DAG de teste com múltiplas buscas",
"skip_null": False,
"doc_md": None,
Expand Down Expand Up @@ -481,6 +477,7 @@ def test_hash_dag_id(yaml_parser, dag_id, size, hashed):
"discord_webhook": None,
"slack_webhook": None,
"schedule": "0 8 * * MON-FRI",
"dataset": None,
"description": "DAG de teste",
"skip_null": True,
"doc_md": None,
Expand Down Expand Up @@ -521,6 +518,7 @@ def test_hash_dag_id(yaml_parser, dag_id, size, hashed):
"discord_webhook": None,
"slack_webhook": None,
"schedule": "0 8 * * MON-FRI",
"dataset": None,
"description": "DAG de teste",
"skip_null": True,
"doc_md": None,
Expand Down

0 comments on commit 8972c96

Please sign in to comment.