(self)
| 181 | self.assertEqual(repr(props.argspec.defaults[0]), "[]") |
| 182 | |
| 183 | def test_issue_966_class_method(self): |
| 184 | class Issue966(Sequence): |
| 185 | @classmethod |
| 186 | def cmethod(cls, number: int, lst: list[int] = []): |
| 187 | """ |
| 188 | Return a list of numbers |
| 189 | |
| 190 | Example: |
| 191 | ======== |
| 192 | C.cmethod(1337, [1, 2]) # => [1, 2, 1337] |
| 193 | """ |
| 194 | return lst + [number] |
| 195 | |
| 196 | @classmethod |
| 197 | def bmethod(cls, number, lst): |
| 198 | """ |
| 199 | Return a list of numbers |
| 200 | |
| 201 | Example: |
| 202 | ======== |
| 203 | C.cmethod(1337, [1, 2]) # => [1, 2, 1337] |
| 204 | """ |
| 205 | return lst + [number] |
| 206 | |
| 207 | props = inspection.getfuncprops( |
| 208 | "bmethod", inspection.getattr_safe(Issue966, "bmethod") |
| 209 | ) |
| 210 | self.assertEqual(props.func, "bmethod") |
| 211 | self.assertEqual(props.argspec.args, ["number", "lst"]) |
| 212 | |
| 213 | props = inspection.getfuncprops( |
| 214 | "cmethod", inspection.getattr_safe(Issue966, "cmethod") |
| 215 | ) |
| 216 | self.assertEqual(props.func, "cmethod") |
| 217 | self.assertEqual(props.argspec.args, ["number", "lst"]) |
| 218 | self.assertEqual(repr(props.argspec.defaults[0]), "[]") |
| 219 | |
| 220 | def test_issue_966_static_method(self): |
| 221 | class Issue966(Sequence): |
nothing calls this directly
no outgoing calls
no test coverage detected