Minitest is inspired by Ruby minispec.
Project description
This project is inspired by Ruby minispec, but now it just implement some methods including:
must_equal, must_true, must_raise.
github: https://github.com/jichen3000/minitest
pypi: https://pypi.python.org/pypi/minitest
How to use
install:
pip instsall minitest
code:
if __name__ == '__main__': # import the minitest from minitest import * import operator # declare a test case with test_case("new test case"): # declare a variable for test tself = get_test_self() # you could put all your test variables on tself # just like declare your variables on setup. tself.jc = "jc" # declare a test with test("test must_equal"): tself.jc.must_equal('jc') with test("test must_true"): True.must_true() False.must_true() # using a funcation to test equal. with test("test must_equal_with_func"): (1).must_equal(1, key=operator.eq) (1).must_equal(2, key=operator.eq) def div_zero(): 1/0 # test exception with test("test must_raise"): (lambda : div_zero()).must_raise(ZeroDivisionError)
result:
Running tests: .FF. Finished tests in 0.011786s. 1) Failure: The line No is [/Users/Colin/work/minitest/minitest/with_test.py:163]: --- expected +++ actual -[True] #[False] 2) Failure: The line No is [/Users/Colin/work/minitest/minitest/with_test.py:168]: --- expected +++ actual -[2] #[1] 4 tests, 6 assertions, 2 failures, 0 errors. [Finished in 0.1s]
Other useful function
p, pp, length, size, these four functions could been used by any object.
code:
"jc".p() # print: jc, just like print "jc".pp() # print: 'jc', just like pprint's pprint [1,2].length() # 2, just like len([1,2]) (1,2).size() # 2, just like len((1,2))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
minitest-0.1.2.tar.gz
(3.7 kB
view details)
File details
Details for the file minitest-0.1.2.tar.gz
.
File metadata
- Download URL: minitest-0.1.2.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 716bd9343278dede2476e4af5a97c5aa4f14f10acd7ba4470c937857641e051e |
|
MD5 | f9b32d567bb2414566105c8e77a3ee5c |
|
BLAKE2b-256 | f3798cc476d7ee66a4cc09f9f7c5ffc867e0585b258712c511f669dac7550adb |