暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

test_leobjectidentifier.py 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import unittest
  2. import inspect
  3. from unittest import mock
  4. from lodel.leapi.datahandlers.datas import LeobjectSubclassIdentifier as Testee
  5. class LeresultectSubclassIdentifierTestCase(unittest.TestCase):
  6. def test_base_type_is_varchar(self):
  7. self.assertEqual(Testee.base_type, 'varchar')
  8. def test_help_property_str_is_set(self):
  9. self.assertEqual(type(Testee.help), str)
  10. def test_throws_error_if_set_as_external(self):
  11. self.assertRaises(RuntimeError, Testee, internal=False)
  12. def test_set_as_internal_by_default(self):
  13. self.assertTrue(Testee().internal)
  14. def test_passing_class_returns_class_name(self):
  15. result = Testee.construct_data(None, object, None, None, None)
  16. self.assertEqual(result, object.__name__)
  17. def test_passing_instance_returns_class_name(self):
  18. result = Testee.construct_data(None, object(), None, None, None)
  19. self.assertTrue(result, object.__name__)
  20. def test_passing_instance_and_class_same_result(self):
  21. objResult = Testee.construct_data(None, Testee(), None, None, None)
  22. clsResult = Testee.construct_data(None, Testee, None, None, None)
  23. self.assertEqual(objResult, clsResult)