()
| 1020 | |
| 1021 | |
| 1022 | def test_commandset_settables() -> None: |
| 1023 | # Define an arbitrary class with some attribute |
| 1024 | class Arbitrary: |
| 1025 | def __init__(self) -> None: |
| 1026 | self.some_value = 5 |
| 1027 | |
| 1028 | # Declare a CommandSet with a settable of some arbitrary property |
| 1029 | class WithSettablesA(CommandSetBase): |
| 1030 | def __init__(self) -> None: |
| 1031 | super().__init__() |
| 1032 | |
| 1033 | self._arbitrary = Arbitrary() |
| 1034 | self._settable_prefix = "addon" |
| 1035 | self.my_int = 11 |
| 1036 | |
| 1037 | self.add_settable( |
| 1038 | Settable( |
| 1039 | "arbitrary_value", |
| 1040 | int, |
| 1041 | "Some settable value", |
| 1042 | settable_object=self._arbitrary, |
| 1043 | settable_attrib_name="some_value", |
| 1044 | ) |
| 1045 | ) |
| 1046 | |
| 1047 | # Declare a CommandSet with an empty settable prefix |
| 1048 | class WithSettablesNoPrefix(CommandSetBase): |
| 1049 | def __init__(self) -> None: |
| 1050 | super().__init__() |
| 1051 | |
| 1052 | self._arbitrary = Arbitrary() |
| 1053 | self._settable_prefix = "" |
| 1054 | self.my_int = 11 |
| 1055 | |
| 1056 | self.add_settable( |
| 1057 | Settable( |
| 1058 | "another_value", |
| 1059 | float, |
| 1060 | "Some settable value", |
| 1061 | settable_object=self._arbitrary, |
| 1062 | settable_attrib_name="some_value", |
| 1063 | ) |
| 1064 | ) |
| 1065 | |
| 1066 | # Declare a commandset with duplicate settable name |
| 1067 | class WithSettablesB(CommandSetBase): |
| 1068 | def __init__(self) -> None: |
| 1069 | super().__init__() |
| 1070 | |
| 1071 | self._arbitrary = Arbitrary() |
| 1072 | self._settable_prefix = "some" |
| 1073 | self.my_int = 11 |
| 1074 | |
| 1075 | self.add_settable( |
| 1076 | Settable( |
| 1077 | "arbitrary_value", |
| 1078 | int, |
| 1079 | "Some settable value", |
nothing calls this directly
no test coverage detected
searching dependent graphs…