{"id":17769917,"url":"https://github.com/jayin/python-tc","last_synced_at":"2025-06-18T07:39:54.594Z","repository":{"id":15522623,"uuid":"18257049","full_name":"Jayin/Python-TC","owner":"Jayin","description":"utils for common test","archived":false,"fork":false,"pushed_at":"2014-08-05T01:04:38.000Z","size":187,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-07T09:12:46.602Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jayin.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":"2014-03-30T04:04:11.000Z","updated_at":"2014-08-06T23:53:19.000Z","dependencies_parsed_at":"2022-08-04T05:00:09.000Z","dependency_job_id":null,"html_url":"https://github.com/Jayin/Python-TC","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/Jayin%2FPython-TC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jayin%2FPython-TC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jayin%2FPython-TC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jayin%2FPython-TC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jayin","download_url":"https://codeload.github.com/Jayin/Python-TC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246652638,"owners_count":20812165,"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":[],"created_at":"2024-10-26T21:19:38.270Z","updated_at":"2025-04-01T14:24:23.956Z","avatar_url":"https://github.com/Jayin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Python-TC\n=====================\n\nutils for common test\n\nExample\n========\n```python\n#coding:utf-8\nfrom tc import TC\n\n\ndef task():\n    for x in range(1,200000,2):\n        pass\n\n#basic\nwith TC() as test:\n    task()\n\n#custom:\nclass T(TC):\n    def __init__(self):\n        super(T,self).__init__()\n\n    def __enter__(self):\n        super(T,self).__enter__()\n        return self\n\n    def __exit__(self, exc_type, exc_val, exc_tb):\n        print('another test:')\n        super(T,self).__exit__(exc_type, exc_val, exc_tb)\n\nprint\nwith T() as t:\n    task()\n```\n\noutput:\n```shell\nTime-consuming: 3.000021 ms\n\nanother test:\nTime-consuming: 3.000021 ms\n```\n\nuse decorator\n===\nmake it more sexy:\n```python\n\n@Test\ndef work():\n    for x in range(1,200000,2):\n        pass\n\nwork()\n```\n\noutput:\n```shell\nTime-consuming: 3.999949 ms\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayin%2Fpython-tc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjayin%2Fpython-tc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayin%2Fpython-tc/lists"}