|
@@ -0,0 +1,57 @@
|
|
1
|
+import unittest
|
|
2
|
+import inspect
|
|
3
|
+from unittest import mock
|
|
4
|
+from unittest.mock import patch
|
|
5
|
+
|
|
6
|
+import leapi_dyncode as dyncode
|
|
7
|
+
|
|
8
|
+from types import *
|
|
9
|
+
|
|
10
|
+from lodel.leapi.datahandlers.datas import LeobjectSubclassIdentifier as Testee
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+class LeresultectSubclassIdentifierTestCase(unittest.TestCase):
|
|
14
|
+
|
|
15
|
+ def test_has_base_type_property(self):
|
|
16
|
+ self.assertTrue(hasattr(Testee, 'base_type'))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+ def test_base_type_is_varchar(self):
|
|
20
|
+ self.assertEqual(Testee.base_type, 'varchar')
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+ def test_has_help_property(self):
|
|
24
|
+ self.assertTrue(hasattr(Testee, 'help'))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+ def test_help_property_str_is_set(self):
|
|
28
|
+ self.assertEqual(type(Testee.help), str)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+ def test_throws_error_if_set_as_external(self):
|
|
32
|
+ self.assertRaises(RuntimeError, Testee, internal=False)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+ def test_set_as_internal_by_default(self):
|
|
36
|
+ self.assertTrue(Testee().internal)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+ def test_passing_class_returns_class_name(self):
|
|
40
|
+ result = Testee.construct_data(None, object, None, None, None)
|
|
41
|
+
|
|
42
|
+ self.assertEqual(result, object .__name__)
|
|
43
|
+ self.assertEqual(type(result), str)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+ def test_passing_instance_returns_class_name(self):
|
|
47
|
+ result = Testee.construct_data(None, object(), None, None, None)
|
|
48
|
+
|
|
49
|
+ self.assertTrue(result, object.__name__)
|
|
50
|
+ self.assertEqual(type(result), str)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+ def test_passing_instance_and_class_same_result(self):
|
|
54
|
+ objResult = Testee.construct_data(None, Testee(), None, None, None)
|
|
55
|
+ clsResult = Testee.construct_data(None, Testee, None, None, None)
|
|
56
|
+
|
|
57
|
+ self.assertEqual(objResult, clsResult)
|