1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
import pytest
from briefcase.config import is_valid_app_name
@pytest.mark.parametrize(
"name",
[
"helloworld",
"helloWorld",
"hello42world",
"42helloworld",
"hello_world",
"hello-world",
],
)
def test_is_valid_app_name(name):
"""Test that valid app names are accepted."""
assert is_valid_app_name(name)
@pytest.mark.parametrize(
"name",
[
"hello world",
"helloworld!",
"_helloworld",
"-helloworld",
"switch",
"pass",
"false",
"False",
"YIELD",
"main",
"socket",
"test",
# ı, İ and K (i.e. 0x212a) are valid ASCII when made lowercase and as such are
# accepted by the official PEP 508 regex... but they are rejected here to ensure
# compliance with the regex that is used in practice.
"helloworld_ı",
"İstanbul",
"Kelvin",
],
)
def test_is_invalid_app_name(name):
"""Test that invalid app names are rejected."""
assert not is_valid_app_name(name)
|