Skip to content
Snippets Groups Projects
Commit df0ea54e authored by Bert Palm's avatar Bert Palm 🎇
Browse files

added tests for xxxSequence from tools

parent 12561ee8
No related branches found
No related tags found
1 merge request!462More tests
# SPDX-FileCopyrightText: 2021 Helmholtz-Zentrum für Umweltforschung GmbH - UFZ
#
# SPDX-License-Identifier: GPL-3.0-or-later
import pytest
import saqc.lib.tools as tools
import pandas as pd
import numpy as np
class _ListLike(list):
pass
@pytest.mark.parametrize('value,expected', [
(None, [None]),
([None], [None]),
(1, [1]),
(np.nan, [np.nan]),
([1], [1]),
('foo', ['foo']),
(['foo'], ['foo']),
([1, 2], [1, 2]),
(_ListLike("ab"), ['a', 'b'])
])
def test_toSequence(value, expected):
result = tools.toSequence(value)
assert isinstance(result, list)
assert result == expected
@pytest.mark.parametrize('value,expected', [
([1], 1),
([[]], []),
([[1, 2]], [1, 2]),
(_ListLike('a'), 'a')
])
def test_squeezeSequence(value, expected):
result = tools.squeezeSequence(value)
assert result == expected
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment