{"id":19917143,"url":"https://github.com/austinv11/tinkertest","last_synced_at":"2026-06-09T03:05:46.441Z","repository":{"id":57475695,"uuid":"145246277","full_name":"austinv11/TinkerTest","owner":"austinv11","description":"Super simple and readable testing/validation in python 3","archived":false,"fork":false,"pushed_at":"2018-08-19T03:10:01.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-11T23:35:19.357Z","etag":null,"topics":["python","python3","testing","unittest","validation"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/TinkerTest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/austinv11.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-18T19:13:43.000Z","updated_at":"2018-08-19T13:29:32.000Z","dependencies_parsed_at":"2022-09-07T17:13:09.648Z","dependency_job_id":null,"html_url":"https://github.com/austinv11/TinkerTest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austinv11%2FTinkerTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austinv11%2FTinkerTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austinv11%2FTinkerTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austinv11%2FTinkerTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/austinv11","download_url":"https://codeload.github.com/austinv11/TinkerTest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241347526,"owners_count":19948147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","python3","testing","unittest","validation"],"created_at":"2024-11-12T21:48:54.857Z","updated_at":"2026-06-09T03:05:46.393Z","avatar_url":"https://github.com/austinv11.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"TinkerTest\n==========\nInline testing/validation in python 3, based on this wonderful blog post: https://tinkering.xyz/abusing-type-annotations/\n\n## What is this?\nTinkerTest aims to simplify data validation checking in both unit tests and production environments. In order to do this\nconveniently, TinkerTest ~~abuses~~ makes use of the fact that python type annotations can be any arbitrary python \nexpression. Using this fact allows us to inject validation logic into your scripts which simply evaluate your type \nannotations.\n\n## Helpful Hint\nStarting from python 3.7, the `annotations` future import exists. This may be helpful for you, as its lazy evaluation\nshould prevent some common mistakes in using this library.\n\n## Trivial Example\n```python\n# my_script.py\nfrom tinkertest import inject_into_type\n\nclass MyClass:\n    my_field: 'my_field \u003c 0'  # This field only accepts values \u003c 0\n    my_str_field: str  # This field only accepts strings\n    \n    def __init__(self, my_field, my_str_field):\n        self.my_field = my_field\n        self.my_str_field = my_str_field\n        \n    # This function only accepts a non-None argument and should always return 1\n    def some_func(self, input_val: 'input_val is not None') -\u003e 'returned == 1':  # 'returned' is a magic variable for use in return annotations\n        ...\n        \ninject_into_type(MyClass)  # Wires all the injections, now any calls will be validated!\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustinv11%2Ftinkertest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faustinv11%2Ftinkertest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustinv11%2Ftinkertest/lists"}