Skip to content

Commit

Permalink
Added a unittest for detected programming language
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi1geeks committed Apr 16, 2024
1 parent 53db174 commit 85f974e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/lang_detection_testcase.py
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()

0 comments on commit 85f974e

Please sign in to comment.