From c9a3006ac36913a8c6c13a1761d856b6c93a3110 Mon Sep 17 00:00:00 2001 From: Tikari Date: Thu, 10 Oct 2024 01:03:22 +0300 Subject: [PATCH] Added test cases for HGS --- tests/test_reacts/test_reacts_hgs.py | 71 ++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 tests/test_reacts/test_reacts_hgs.py diff --git a/tests/test_reacts/test_reacts_hgs.py b/tests/test_reacts/test_reacts_hgs.py new file mode 100644 index 0000000..37e7aef --- /dev/null +++ b/tests/test_reacts/test_reacts_hgs.py @@ -0,0 +1,71 @@ +import pytest +from functions.reacts import check_resource_match +POSITIVE_TEST_CASES = ( + "HGS", + "hot gay sex", + "karstas geju seksas", + "karštas geju seksas", + "karstas gėju seksas", + "karštas gėju seksas", + "karstas gejų seksas", + "karštas gejų seksas", + "karstas gėjų seksas", + "karštas gėjų seksas", + "dedzīgs geju sekss", + "kaislīgs geju sekss", + "karsts geju sekss", + "Kuum gei seks", + "гарячий гей секс", +) + +POSITIVE_TEST_CASES_MANDARIN = ( + "激情同志性愛", + "激情同志性交", + "激情同性性愛", + "激情同性性交", + "熱烈同志性愛", + "熱烈同志性交", + "熱烈同性性愛", + "熱烈同性性交", + "ㄏㄍㄙ", +) + + +@pytest.mark.parametrize( + "test_str", + POSITIVE_TEST_CASES + POSITIVE_TEST_CASES_MANDARIN, +) + +def test_react_hgs_regex_yes_match(test_str: str): + """Tests that these strings return TRUE.""" + # * isolated string + assert check_resource_match(test_str, resource_name='hgs') + # * surrounded by spaces + assert check_resource_match(f" {test_str} ", resource_name='hgs') + # * to lowercase + assert check_resource_match(test_str.lower(), resource_name='hgs') + # * to title case + assert check_resource_match(test_str.title(), resource_name='hgs') + +@pytest.mark.parametrize( + "test_str", + POSITIVE_TEST_CASES, +) +def test_react_hgs_regex_no_match(test_str: str): + """Tests that these strings return FALSE when surrounded by text.""" + # * surrounded by text + assert not check_resource_match(f"a{test_str}b", resource_name='hgs') + +@pytest.mark.parametrize( + "test_str", + POSITIVE_TEST_CASES_MANDARIN, +) +def test_react_hgs_mandarin_yes_match(test_str: str): + """Tests that these Mandarin strings return TRUE.""" + # * isolated string + assert check_resource_match(test_str, resource_name='hgs') + # * surrounded by spaces + assert check_resource_match(f" {test_str} ", resource_name='hgs') + # * surrounded by text (ok for Mandarin) + assert check_resource_match(f"a{test_str}b", resource_name='hgs') + assert check_resource_match(f"哈{test_str}囉", resource_name='hgs') \ No newline at end of file