From 1cce8fe30a73f538ed63e88d7c09e18456d333b9 Mon Sep 17 00:00:00 2001
From: Hong-Phuc Bui <hong-phuc.bui@htwsaar.de>
Date: Wed, 19 Jun 2024 10:01:45 +0200
Subject: [PATCH] test

---
 study-effort/tests/mystudy/lecture_test.py |   50 +++++++++++++++++++++++++++++++++++---------------
 1 files changed, 35 insertions(+), 15 deletions(-)

diff --git a/study-effort/tests/mystudy/lecture_test.py b/study-effort/tests/mystudy/lecture_test.py
index d82108a..cc6f0f8 100644
--- a/study-effort/tests/mystudy/lecture_test.py
+++ b/study-effort/tests/mystudy/lecture_test.py
@@ -1,22 +1,42 @@
 import unittest
-from mystudy import lecture
+from mystudy.lecture import Lecture, parse_lecture_line
+
+EPSILON = 0.01
+
+class LectureTestCase(unittest.TestCase):
+    def test_constructor(self):
+        n = "Mathematik"
+        ects = 5
+        f = 2.5
+        mathe2 = Lecture(n, ects, f)
+        english = Lecture("English", 2, 1)
+        print(mathe2)
+        print(english)
+        text = f"{mathe2} am Montag"
+        text2 = f"{mathe2} im Studiengang MAM"
+        print(text)
 
 
-class MyTestCase(unittest.TestCase):
-    def test_something(self):
-        ects_python = 2
-        lecture_per_week = 2
-        effort_per_week = lecture.lecture_effort(lecture_per_week, ects_python)
-        self.assertEqual(effort_per_week, 1.0)  # add assertion here
+    def test_cal_effort(self):
+        n = "Mathematik",
+        ects = 5
+        f = 2.5
+        mathe2 = Lecture(n, ects, f)
+        e1 = mathe2.cal_effort()
+        # self.assertEqual(e1, 6)
+        diff = abs(e1 - 6.25)
+        self.assertTrue(diff < EPSILON)
 
-    def test_format(self):
-        ects = 3
-        lecture_per_week = 2
-        name = "Informatik"
-        text = lecture.format_lecture_effort(name, lecture_per_week, ects, 8)
-        self.assertTrue(text.index(f"{ects}") >= 0)
-        self.assertTrue(text.index(name) >= 0)
-        self.assertTrue(text.index("8"))
+        e2 = mathe2.cal_effort(time_per_ects=20)
+        diff = abs(e2 - 2.92)
+        # self.assertEqual(e2, 7)
+        self.assertTrue(diff < EPSILON)
+
+    def test_parse_lecture_line(self):
+        data = "English; 3; 2"
+        english = parse_lecture_line(data)
+        text = "Vorlesungsname English ECTS: 2"
+        self.assertEqual(text, f"{english}")
 
 
 if __name__ == '__main__':

--
Gitblit v1.10.0-SNAPSHOT