diff --git a/README.md b/README.md index 0caf31e..cd45274 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Python Version](https://img.shields.io/badge/python-3.13+-blue.svg)](https://www.python.org/downloads/) [![License](https://img.shields.io/badge/license-GPL--3.0-green.svg)](LICENSE) ![Development Status](https://img.shields.io/badge/status-beta-orange.svg) -![Version](https://img.shields.io/badge/version-3.6.10-blue.svg) +![Version](https://img.shields.io/badge/version-3.6.11-blue.svg) **Pyrox** is a Python back-end engine and application framework built on **PyQt6**. It provides a rich set of interfaces, models, services, and abstractions for building industrial automation and desktop applications. Pyrox is designed to be used as a foundation — downstream projects like [ControlRox](https://github.com/iroxusux/ControlRox) build their entire application layer on top of it. diff --git a/pyproject.toml b/pyproject.toml index 13dab4c..ea5770b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "pyrox" -version = "3.6.10" +version = "3.6.11" authors = [{ name = "Brian LaFond", email = "Brian.L.LaFond@gmail.com" }] description = "Python based irox engine." readme = "README.md" diff --git a/pyrox/core/validators.py b/pyrox/core/validators.py index baf08ab..79462b1 100644 --- a/pyrox/core/validators.py +++ b/pyrox/core/validators.py @@ -1,7 +1,7 @@ from typing import Any -def unsafe_assert_is_type(value: Any, type_check: type) -> None: +def unsafe_assert_is_type(value: Any, type_check: type | tuple[type, ...]) -> None: """Common use type check assertion. Useful for single line, compact type checking to raise a common message to the user. Doesn't return anything, as it is unsafe and will stop execution in place. diff --git a/test/core/test_validators.py b/test/core/test_validators.py index 5b6412a..04b9906 100644 --- a/test/core/test_validators.py +++ b/test/core/test_validators.py @@ -33,3 +33,10 @@ def test_incorrect_value_raises_value_error_with_message(self): with pytest.raises(ValueError) as context: unsafe_assert_is_type('string', int) assert context.exconly() == f'ValueError: Expected type {str(int)}, but got {str(str)}!' + + def test_pass_when_tuple_is_correct(self): + unsafe_assert_is_type(1, (int, float)) + + def test_fail_when_tuple_is_not_correct(self): + with pytest.raises(ValueError): + unsafe_assert_is_type('string', (int, float))