mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Add tests for courses, change study guide description
This commit is contained in:
parent
c6958d22f3
commit
9819e82638
3 changed files with 37 additions and 2 deletions
32
tests/test_data/test_courses.py
Normal file
32
tests/test_data/test_courses.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import unittest
|
||||
|
||||
from data.courses import load_courses, find_course_from_name
|
||||
|
||||
|
||||
class TestCourses(unittest.TestCase):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.courses = load_courses()
|
||||
|
||||
def test_find_course(self):
|
||||
self.assertIsNone(find_course_from_name("garbage", self.courses))
|
||||
self.assertIsNone(find_course_from_name("garbage"))
|
||||
|
||||
# Find by name
|
||||
webdev = find_course_from_name("Webdevelopment", self.courses)
|
||||
self.assertIsNotNone(webdev)
|
||||
self.assertEqual(webdev.code, "C003779")
|
||||
|
||||
# Find by abbreviation
|
||||
infosec = find_course_from_name("infosec", self.courses)
|
||||
self.assertIsNotNone(infosec)
|
||||
self.assertEqual(infosec.code, "E019400")
|
||||
|
||||
# Case sensitive
|
||||
not_found = find_course_from_name("ad3", self.courses, case_insensitive=False)
|
||||
self.assertIsNone(not_found)
|
||||
|
||||
# Find by alt name
|
||||
pcs = find_course_from_name("parallel computer systems", self.courses)
|
||||
self.assertIsNotNone(pcs)
|
||||
self.assertEqual(pcs.code, "E034140")
|
||||
Loading…
Add table
Add a link
Reference in a new issue