Peter Pentchev | b91fc93 | 2023-01-19 15:27:13 +0200 | [diff] [blame^] | 1 | # SPDX-FileCopyrightText: StorPool <support@storpool.com> |
| 2 | # SPDX-License-Identifier: BSD-2-Clause |
| 3 | """Test the gifn_apply.util functions.""" |
| 4 | |
| 5 | import pytest |
| 6 | |
| 7 | from gifn_apply import util |
| 8 | |
| 9 | |
| 10 | @pytest.mark.parametrize( |
| 11 | ("value", "prefix", "expected"), |
| 12 | [ |
| 13 | ("hello", "goodbye", "hello"), |
| 14 | ("hello", "hel", "lo"), |
| 15 | ("hel", "hello", "hel"), |
| 16 | ("hello", "hello", ""), |
| 17 | ], |
| 18 | ) |
| 19 | def test_remove_prefix(value: str, prefix: str, expected: str) -> None: |
| 20 | """Test our hand-rolled str.removeprefix() implementation.""" |
| 21 | assert util.str_removeprefix(value, prefix) == expected |