No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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)