From e3170b0601b61912fbf68d1a0da9b9946796d67a Mon Sep 17 00:00:00 2001 From: Eduardo Apolinario Date: Mon, 16 Aug 2021 21:10:26 -0700 Subject: [PATCH] Linting Signed-off-by: Eduardo Apolinario --- tests/flytekit/unit/core/test_local_cache.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/flytekit/unit/core/test_local_cache.py b/tests/flytekit/unit/core/test_local_cache.py index 51c24112c2..4c90cf2fa3 100644 --- a/tests/flytekit/unit/core/test_local_cache.py +++ b/tests/flytekit/unit/core/test_local_cache.py @@ -1,17 +1,17 @@ import datetime import typing from dataclasses import dataclass -from dataclasses_json import dataclass_json -from pytest import fixture import pandas +from dataclasses_json import dataclass_json +from pytest import fixture from flytekit import SQLTask, kwtypes from flytekit.core.local_cache import LocalCache from flytekit.core.task import TaskMetadata, task +from flytekit.core.testing import task_mock from flytekit.core.workflow import workflow from flytekit.types.schema import FlyteSchema -from flytekit.core.testing import patch, task_mock # Global counter used to validate number of calls to cache n_cached_task_calls = 0 @@ -25,6 +25,7 @@ def setup(): LocalCache.initialize() LocalCache.clear() + def test_1(): @task(cache=True, cache_version="v1") def f1(n: int) -> int: @@ -50,6 +51,7 @@ def wf(n: int) -> (int, int): assert wf(n=1) == (1, 2) assert 1 == 2 + def test_single_task_workflow(): @task(cache=True, cache_version="v1") def is_even(n: int) -> bool: @@ -110,8 +112,10 @@ def check_oddness_wf2(n: int) -> bool: assert check_oddness_wf2(n=99) is True assert n_cached_task_calls == 2 + # TODO add test with typing.List[str] + def test_sql_task(): sql = SQLTask( "my-query", @@ -143,6 +147,7 @@ def my_wf() -> FlyteSchema: assert (my_wf().open().all() == pandas.DataFrame(data={"x": [1, 2], "y": ["3", "4"]})).all().all() assert n_cached_task_calls == 1 + def test_wf_custom_types(): @dataclass_json @dataclass