Skip to content

Commit

Permalink
fix detecting C# and C++ (issue with word boundary)
Browse files Browse the repository at this point in the history
  • Loading branch information
honzajavorek committed May 29, 2023
1 parent b288f82 commit 6424d30
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions juniorguru_chick/lib/intro.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
re.compile(r'\bfront\-?end\w*\b', re.I): ['<:html:842343387964375050>', '<:css:842343369618751519>', '<:javascript:842329110293381142>'],
re.compile(r'\bbootstrap\w*\b', re.I): ['<:bootstrap:900834695422545940>', '<:css:842343369618751519>'],
re.compile(r'\btailwind\w*\b', re.I): ['<:tailwind:900834412248309770>', '<:css:842343369618751519>'],
re.compile(r'\bC#\b'): ['<:csharp:842666113230045224>'],
re.compile(r'\bC\#\W'): ['<:csharp:842666113230045224>'],
re.compile(r'\b\.NET\b', re.I): ['<:csharp:842666113230045224>'],
re.compile(r'\b(java|javy|javě|javu|javou)\b', re.I): ['<:java:1036333651740327966>'],
re.compile(r'\bkotlin\w*\b', re.I): ['<:kotlin:1001234560056578149>'],
re.compile(r'\bC\+\+\b'): ['<:cpp:842666129071931433>'],
re.compile(r'\bC\+\+\W'): ['<:cpp:842666129071931433>'],
re.compile(r'\breact\w*\b', re.I): ['<:react:842332165822742539>'],
re.compile(r'\bvue\b', re.I): ['<:vue:842332056138416168>'],
re.compile(r'\bangular\w*\b', re.I): ['<:angular:844527194730266694>'],
Expand Down
9 changes: 9 additions & 0 deletions tests/test_lib_intro.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pytest
from juniorguru_chick.lib.intro import choose_intro_emojis


Expand All @@ -8,3 +9,11 @@ def test_choose_intro_emojis():
"""

assert '<:python:842331892091322389>' in choose_intro_emojis(message_content)


@pytest.mark.parametrize('message_content, expected_emoji', [
('základní struktury v pythonu a C# v ITnetwork', '<:csharp:842666113230045224>'),
('Láká mě C++ a C#', '<:cpp:842666129071931433>'),
])
def test_choose_intro_emoji_edge_cases(message_content, expected_emoji):
assert expected_emoji in choose_intro_emojis(message_content)

0 comments on commit 6424d30

Please sign in to comment.