One function
Boundary in zobweyt/textcase
The author described this change as “fix: use `@classmethod` instead of `@staticmethod` and `TypeVar` in `Boundary.from_delimiter` for proper inheritance typing (#33)”. It counts as a record because the check below fails on the code as it stood at d47597d19 and passes on 3cfc56bcc, with nothing else changed between the two runs.
Projectzobweyt/textcase
Fix saved2025-10-01
Sharing licenceMIT · LICENSE
Change size+3 −3
What the code was meant to do, written into the code itself as a docstring
Represents a condition for splitting an identifier into words. Some boundaries, `HYPHEN`, `UNDERSCORE`, `SPACE`, and `INTERPUNCT` consume the character they split on, whereas the other boundaries do not. Examples: True False 0 1
The change
| 30 | 30 | length: int = 0 | |
| 31 | 31 | """The length of the boundary. This is the number of graphemes that are removed when splitting.""" | |
| 32 | 32 | ||
| 33 | - | @staticmethod | |
| 34 | - | def from_delimiter(delimiter: str) -> "Boundary": | |
| 33 | + | @classmethod | |
| 34 | + | def from_delimiter(cls: type[_TBoundary], delimiter: str) -> _TBoundary: | |
| 35 | 35 | """Create a new boundary instance from a delimiter string. | |
| 36 | 36 | ||
| 37 | 37 | This method makes it easier to create basic boundaries like `UNDERSCORE`, `HYPHEN`, `SPACE`, and `INTERPUNCT`. | |
| ⋯ | |||
| 58 | 58 | >>> DOT.length | |
| 59 | 59 | 1 | |
| 60 | 60 | """ | |
| 61 | - | return Boundary(match=lambda s: s.startswith(delimiter), length=len(delimiter)) | |
| 61 | + | return cls(match=lambda s: s.startswith(delimiter), length=len(delimiter)) | |
The check that tells the two apart
fail→pass·tests/boundaries/test_boundary_from_delimiter.py::test_return_type_of_custom_subclass
Check file tests/boundaries/test_boundary_from_delimiter.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itd47597d196ee286423e09041218d39c7680677a9
Broken version dated2025-10-01
Moduletextcase.__init__
Units changedBoundary
Fingerprintce753d7eea707e6a
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.