Check that all submobjects are actually instances of :class:`Mobject`, and that none of them is ``self`` (a :class:`Mobject` cannot contain itself). This is an auxiliary function called when adding Mobjects to the :attr:`submobjects` list. This function is i
(self, submobjects: Iterable[Mobject])
| 119 | self.init_colors() |
| 120 | |
| 121 | def _assert_valid_submobjects(self, submobjects: Iterable[Mobject]) -> Self: |
| 122 | """Check that all submobjects are actually instances of |
| 123 | :class:`Mobject`, and that none of them is ``self`` (a |
| 124 | :class:`Mobject` cannot contain itself). |
| 125 | |
| 126 | This is an auxiliary function called when adding Mobjects to the |
| 127 | :attr:`submobjects` list. |
| 128 | |
| 129 | This function is intended to be overridden by subclasses such as |
| 130 | :class:`VMobject`, which should assert that only other VMobjects |
| 131 | may be added into it. |
| 132 | |
| 133 | Parameters |
| 134 | ---------- |
| 135 | submobjects |
| 136 | The list containing values to validate. |
| 137 | |
| 138 | Returns |
| 139 | ------- |
| 140 | :class:`Mobject` |
| 141 | The Mobject itself. |
| 142 | |
| 143 | Raises |
| 144 | ------ |
| 145 | TypeError |
| 146 | If any of the values in `submobjects` is not a :class:`Mobject`. |
| 147 | ValueError |
| 148 | If there was an attempt to add a :class:`Mobject` as its own |
| 149 | submobject. |
| 150 | """ |
| 151 | return self._assert_valid_submobjects_internal(submobjects, Mobject) |
| 152 | |
| 153 | def _assert_valid_submobjects_internal( |
| 154 | self, submobjects: list[Mobject], mob_class: type[Mobject] |
no test coverage detected