| 1 |
# -------------------------------------------------------------------------------------- |
| 2 |
# Copyright (c) 2014-2024,, Nucleic Development Team. |
| 3 |
# |
| 4 |
# Distributed under the terms of the Modified BSD License. |
| 5 |
# |
| 6 |
# The full license is in the file LICENSE, distributed with this software. |
| 7 |
# -------------------------------------------------------------------------------------- |
| 8 |
import pytest |
| 9 |
|
| 10 |
from kiwisolver import strength |
| 11 |
|
| 12 |
|
| 13 |
def test_accessing_predefined_strength() -> None: |
| 14 |
"""Test getting the default values for the strength.""" |
| 15 |
assert strength.weak < strength.medium |
| 16 |
assert strength.medium < strength.strong |
| 17 |
assert strength.strong < strength.required |
| 18 |
|
| 19 |
|
| 20 |
def test_creating_strength() -> None: |
| 21 |
"""Test creating strength from constituent values.""" |
| 22 |
assert strength.create(0, 0, 1) < strength.create(0, 1, 0) |
| 23 |
assert strength.create(0, 1, 0) < strength.create(1, 0, 0) |
| 24 |
assert strength.create(1, 0, 0, 1) < strength.create(1, 0, 0, 4) |
| 25 |
|
| 26 |
with pytest.raises(TypeError): |
| 27 |
strength.create("", "", "") # type: ignore |