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

tests for concatDios

parent 8bea50e3
No related branches found
No related tags found
1 merge request!462More tests
Pipeline #93440 passed with stage
in 2 minutes and 2 seconds
......@@ -3,6 +3,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
import pytest
from dios import DictOfSeries as DoS
import saqc.lib.tools as tools
import pandas as pd
import numpy as np
......@@ -68,3 +69,33 @@ def test_toSequence(value, expected):
def test_squeezeSequence(value, expected):
result = tools.squeezeSequence(value)
assert result == expected
@pytest.mark.parametrize(
"data, expected",
[
# 2c + 1c -> 3c
([DoS(dict(a=[1], b=[2])), DoS(dict(c=[3]))], DoS(dict(a=[1], b=[2], c=[3]))),
# 1c + 1c + 1c -> 3c
(
[DoS(dict(a=[1])), DoS(dict(b=[1])), DoS(dict(c=[1]))],
DoS(dict(a=[1], b=[1], c=[1])),
),
# 2c + 1c (overwrite) = 2c
([DoS(dict(a=[1], b=[2])), DoS(dict(b=[22]))], DoS(dict(a=[1], b=[22]))),
# 1c + 1c + 1c (all overwrite) -> 1c
(
[DoS(dict(a=[1])), DoS(dict(a=[11])), DoS(dict(a=[111]))],
DoS(dict(a=[111])),
),
],
)
def test_concatDios(data, expected):
result = tools.concatDios(data, warn=False)
assert result == expected
@pytest.mark.parametrize("data", [[DoS(dict(a=[1], b=[2])), DoS(dict(b=[22]))]])
def test_concatDios_warning(data):
with pytest.warns(UserWarning):
tools.concatDios(data, warn=True, stacklevel=0)
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