Skip to content

Commit 1300ea1

Browse files
committed
Add a few more cases to the import tests for completeness
Signed-off-by: Emerson Knapp <[email protected]>
1 parent bc11486 commit 1300ea1

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

test/test_dynamic_attrs.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,23 @@ def parse(cls, entity, parser):
4343
return cls, kwargs
4444

4545

46-
def test_regular_action_load():
47-
test_group = actions.group()
46+
def test_action_getattr():
47+
group = actions.group
48+
assert group.__name__ == 'group'
49+
test_group = group()
4850
assert test_group.type_name == 'group'
4951

5052

51-
def test_dynamic_action_create():
52-
name = actions.let.__name__
53-
assert name == 'let'
54-
str_repr = str(actions.let)
53+
def test_action_import():
54+
from launch_frontend_py import let
55+
assert let.__name__ == 'let'
56+
str_repr = str(let)
5557
assert str_repr.startswith('<function let')
5658

59+
x = let(name='test_name', value='test_value')
60+
assert x.get_attr('name') == 'test_name'
61+
assert x.get_attr('value') == 'test_value'
62+
5763

5864
def test_invalid_action_raise():
5965
with pytest.raises(AttributeError):
@@ -62,6 +68,9 @@ def test_invalid_action_raise():
6268
with pytest.raises(AttributeError):
6369
_ = actions.other_nonexistent
6470

71+
with pytest.raises(ImportError):
72+
import launch_frontend_py.non_existent_import # noqa: F401
73+
6574

6675
def test_dynamic_attrs():
6776
test_arg = actions.arg(name='argname', default='argvalue')

0 commit comments

Comments
 (0)