-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/condecon/adaptivetesting int…
…o dev
- Loading branch information
Showing
4 changed files
with
131 additions
and
4 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
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
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
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,48 @@ | ||
from unittest import TestCase | ||
from ..models import TestItem, load_test_items_from_dict | ||
|
||
class TestLoadTestItems(TestCase): | ||
def __init__(self, methodName = "runTest"): | ||
super().__init__(methodName) | ||
self.item1 = TestItem() | ||
self.item1.a = 0.9 | ||
self.item1.b = 5 | ||
self.item1.c = 0.9 | ||
|
||
self.item2 = TestItem() | ||
self.item2.a = 1.9 | ||
self.item2.b = 3 | ||
self.item2.c = 1.9 | ||
|
||
def test_load_test_items_from_dict_success(self): | ||
source_dictionary: dict[str, list[float]] = { | ||
"a": [0.9, 1.9], | ||
"b": [5, 3], | ||
"c": [0.9, 1.9], | ||
"d": [1, 1] | ||
} | ||
|
||
generated = load_test_items_from_dict(source_dictionary) | ||
|
||
self.assertEqual([self.item1.as_dict(), self.item2.as_dict()], [i.as_dict() for i in generated]) | ||
|
||
def test_load_test_items_from_dict_error_none(self): | ||
source_dictionary: dict[str, list[float]] = { | ||
"a": [0.9, 1.9], | ||
"b": [5, 3], | ||
"c": [0.9, 1.9], | ||
} | ||
|
||
with self.assertRaises(ValueError): | ||
load_test_items_from_dict(source_dictionary) | ||
|
||
def test_load_test_items_from_dict_error_length(self): | ||
source_dictionary: dict[str, list[float]] = { | ||
"a": [0.9, 1.9], | ||
"b": [5, 3], | ||
"c": [0.9, 1.9], | ||
"d": [1] | ||
} | ||
|
||
with self.assertRaises(ValueError): | ||
load_test_items_from_dict(source_dictionary) |