From e514b48d4146defe05aa50424aa824a739fa3a59 Mon Sep 17 00:00:00 2001 From: Salomon Popp Date: Wed, 11 Oct 2023 10:46:15 +0200 Subject: [PATCH] Expand test --- tests/utils/test_environment.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/utils/test_environment.py b/tests/utils/test_environment.py index 381431e8c..b3768f4b5 100644 --- a/tests/utils/test_environment.py +++ b/tests/utils/test_environment.py @@ -1,4 +1,5 @@ import os +from collections.abc import ItemsView, KeysView, ValuesView from unittest.mock import ANY import pytest @@ -37,10 +38,15 @@ def test_update_os_environ(environment: Environment): assert "TEST" in environment assert environment["TEST"] == "test" keys = environment.keys() + assert isinstance(keys, KeysView) assert "TEST" in keys - assert "test" in environment.values() - items = dict(environment.items()) - assert items["TEST"] == "test" + values = environment.values() + assert isinstance(values, ValuesView) + assert "test" in values + items = environment.items() + assert isinstance(items, ItemsView) + d = dict(items) + assert d["TEST"] == "test" def test_mapping(): @@ -65,3 +71,11 @@ def test_dict(environment: Environment): "ENVIRONMENT": "here", "PYTEST_CURRENT_TEST": ANY, } + + +def test_dict_unpacking(environment: Environment): + assert {**environment} == { + "MY": "fake", + "ENVIRONMENT": "here", + "PYTEST_CURRENT_TEST": ANY, + }