-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
68 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,68 @@ | ||
import unittest | ||
|
||
from BPTK_Py import Model | ||
|
||
from BPTK_Py.sddsl.element import Element | ||
|
||
class TestElement(unittest.TestCase): | ||
def setUp(self): | ||
pass | ||
|
||
def testElementInit(self): | ||
model = Model() | ||
|
||
element = Element(model=model,name="testElement",function_string=None) | ||
|
||
self.assertEqual(element.model,model) | ||
self.assertEqual(element.name,"testElement") | ||
self.assertEqual(element.converters,[]) | ||
self.assertEqual(element._function_string,element.default_function_string()) | ||
self.assertIsNone(element._equation) | ||
|
||
self.assertFalse(element.arrayed) | ||
self.assertFalse(element.named_arrayed) | ||
|
||
def testElement_add_arr_equation(self): | ||
model = Model() | ||
|
||
element = Element(model=model,name="testElement",function_string=None) | ||
|
||
result = element.add_arr_equation(name="testName",value=1) | ||
|
||
self.assertIsNone(result) | ||
|
||
def testElement_add_arr_empty(self): | ||
model = Model() | ||
|
||
element = Element(model=model,name="testElement",function_string=None) | ||
|
||
result = element.add_arr_empty(name="testName") | ||
|
||
self.assertIsNone(result) | ||
|
||
def testElement_get_arr_equation(self): | ||
model = Model() | ||
|
||
element = Element(model=model,name="testElement",function_string=None) | ||
|
||
result = element.get_arr_equation(name="testName") | ||
|
||
self.assertIsNone(result) | ||
|
||
def testElement_get_item_unarrayed(self): | ||
model = Model() | ||
|
||
element = Element(model=model,name="testElement",function_string=None) | ||
|
||
self.assertRaises(Exception,element.__getitem__,"testKey") | ||
|
||
def testElement_set_item_unarrayed(self): | ||
model = Model() | ||
|
||
element = Element(model=model,name="testElement",function_string=None) | ||
|
||
self.assertRaises(Exception,element.__setitem__,"testKey") | ||
|
||
if __name__ == '__main__': | ||
unittest.main() | ||
|