Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jayin/python-tc
utils for common test
https://github.com/jayin/python-tc
Last synced: 10 days ago
JSON representation
utils for common test
- Host: GitHub
- URL: https://github.com/jayin/python-tc
- Owner: Jayin
- License: mit
- Created: 2014-03-30T04:04:11.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-08-05T01:04:38.000Z (over 10 years ago)
- Last Synced: 2024-04-14T20:12:27.729Z (7 months ago)
- Language: Python
- Size: 183 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Python-TC
=====================utils for common test
Example
========
```python
#coding:utf-8
from tc import TCdef task():
for x in range(1,200000,2):
pass#basic
with TC() as test:
task()#custom:
class T(TC):
def __init__(self):
super(T,self).__init__()def __enter__(self):
super(T,self).__enter__()
return selfdef __exit__(self, exc_type, exc_val, exc_tb):
print('another test:')
super(T,self).__exit__(exc_type, exc_val, exc_tb)
with T() as t:
task()
```output:
```shell
Time-consuming: 3.000021 msanother test:
Time-consuming: 3.000021 ms
```use decorator
===
make it more sexy:
```python@Test
def work():
for x in range(1,200000,2):
passwork()
```output:
```shell
Time-consuming: 3.999949 ms
```