From 363aaf325470ebc98245b7bdc794c8ccbe0f62f9 Mon Sep 17 00:00:00 2001 From: Adam Saleh Date: Jul 14 2021 11:02:14 +0000 Subject: Add first regex test --- diff --git a/test_requirements.txt b/test_requirements.txt index 3ce6144..3329503 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,3 +1,4 @@ flake8 black mypy +pytest \ No newline at end of file diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/__init__.py diff --git a/tests/test_regex.py b/tests/test_regex.py new file mode 100644 index 0000000..816c2e1 --- /dev/null +++ b/tests/test_regex.py @@ -0,0 +1,17 @@ +from countme.regex import COUNTME_USER_AGENT_RE + + +def test_useragent_re(): + groups = COUNTME_USER_AGENT_RE.match( + "libdnf (os_name os_version; os_variant; os_canon.os_arch)" + ).groups() + assert groups == ( + "libdnf", + "libdnf", + None, + "os_name", + "os_version", + "os_variant", + "os_canon", + "os_arch", + ) diff --git a/tox.ini b/tox.ini index e096a0c..167cc2b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = lint,format,mypy +envlist = lint,format,mypy,py36 [testenv] basepython = python3.6 @@ -8,6 +8,8 @@ deps = -rtest_requirements.txt whitelist_externals = rm +commands = + python -m pytest [testenv:lint] deps =