Whole file
erezsh/runtype
The author described this change as “Fix tuple validation (Issue #6)”. It counts as a record because the check below fails on the code as it stood at 61a6f2f11 and passes on b251aff31, with nothing else changed between the two runs.
Projecterezsh/runtype
Fix saved2021-10-09
Sharing licenceMIT · LICENSE
Change size+4 −0
What the code was meant to do, written into the code itself as a save note
Fix tuple validation (Issue #6)
The change
| 51 | 51 | ||
| 52 | 52 | ||
| 53 | 53 | class ProductType(ProductType, PythonType): | |
| 54 | + | """Used for Tuple | |
| 55 | + | """ | |
| 54 | 56 | def validate_instance(self, obj, sampler=None): | |
| 57 | + | if not isinstance(obj, tuple): | |
| 58 | + | raise TypeMismatchError(f"Expected a tuple. Got {type(obj)}") | |
| 55 | 59 | if self.types and len(obj) != len(self.types): | |
| 56 | 60 | raise LengthMismatchError(self, obj) | |
| 57 | 61 | for type_, item in zip(self.types, obj): |
The check that tells the two apart
fail→pass·tests/test_basic.py::TestIsa::test_basic
Check file tests/test_basic.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 it61a6f2f11390de053eb75247ec809fe642a53282
Broken version dated2021-10-09
Moduleruntype.pytypes
Units changedProductType
Fingerprint19d21d8918bf657a
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.