-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a unittest for detected programming language
- Loading branch information
1 parent
53db174
commit 85f974e
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import unittest | ||
|
||
from pypacter.programming_lang_detector import detect_language | ||
|
||
|
||
class TestProgrammingLanguageDetection(unittest.TestCase): | ||
""" | ||
Test case for the language detection function. | ||
""" | ||
|
||
def test_programming_lang_detector_functionality(self) -> None: | ||
""" | ||
Test the programming_lang_detector function with a simple code snippet. | ||
""" | ||
# Creating a simple Python code snippet | ||
python_code_snippet = "print('Hello, world!')" | ||
|
||
# Calling the detect_language function for output | ||
detected_language = detect_language(python_code_snippet) | ||
|
||
# Printing the language detected | ||
assert "python" in detected_language.lower() | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |