mirror of
https://github.com/yweber/lodel2.git
synced 2026-06-30 04:50:48 +02:00
[EmFieldGroup] Changed the assertions for the init tests with bad arguments
This commit is contained in:
parent
03113ae8bf
commit
f1d819c254
2 changed files with 3 additions and 4 deletions
|
|
@ -104,8 +104,6 @@ class Model(object):
|
|||
# @param uid int : An EmComponent uid
|
||||
# @return The corresponding instance or False if uid don't exists
|
||||
def component(self, uid):
|
||||
if not isinstance(uid, int) or not isinstance(uid, str):
|
||||
raise TypeError
|
||||
return False if uid not in self._components['uids'] else self._components['uids'][uid]
|
||||
|
||||
## Sort components by rank in Model::_components
|
||||
|
|
|
|||
|
|
@ -126,8 +126,9 @@ class TestInit(FieldGroupTestCase):
|
|||
# TODO Voir si on garde le return False de Model.component() ou si on utilise plutôt une exception EmComponentNotExistError en modifiant le reste du code source pour gérer ce cas
|
||||
self.assertFalse(EM_TEST_OBJECT.component(baduid), msg="Should be False because fieldgroup with id " + str(baduid) + " should not exist")
|
||||
self.assertFalse(EM_TEST_OBJECT.component(badname), msg="Should be False because fieldgroup with id " + str(badname) + " should not exist")
|
||||
self.assertFalse(EM_TEST_OBJECT.component(print), msg="Should be False when crazy arguments are given")
|
||||
self.assertFalse(EM_TEST_OBJECT.component(['hello', 'world']), msg="Should be False when crazy arguments are given")
|
||||
self.assertFalse(EM_TEST_OBJECT.component(print), msg="Should be False when a function name is given as argument")
|
||||
with self.assertRaises(TypeError, msg="Should raise when crazy arguments are given"):
|
||||
fieldgroup = EM_TEST_OBJECT.component(['hello', 'world'])
|
||||
|
||||
|
||||
'''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue