Popular recipes tagged "meta:requires=test"http://code.activestate.com/recipes/tags/meta:requires=test/2009-10-08T19:49:28-07:00ActiveState Code RecipesTest byt2str Module (Python)
2009-10-08T19:49:28-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/576926-test-byt2str-module/
<p style="color: grey">
Python
recipe 576926
by <a href="/recipes/users/2608421/">Stephen Chappell</a>
(<a href="/recipes/tags/byt2str/">byt2str</a>, <a href="/recipes/tags/testing/">testing</a>).
Revision 2.
</p>
<p>To ensure that the "byt2str" module operates correctly, the following unit test has been devised. This recipe should ensure the correctness of the code and validate all corrections for accuracy when run. If you are not familiar with the "unittest" or "test" modules, this code may of be interest for the purpose of developing your own library validation suites. Testing code is important for providing a certain amount of assurance that the code being run is correct. If the code is changed incorrectly, a test like this should be able to detect a problem.</p>
Utility Mill Support Example (Python)
2009-06-03T14:36:25-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/576793-utility-mill-support-example/
<p style="color: grey">
Python
recipe 576793
by <a href="/recipes/users/2608421/">Stephen Chappell</a>
(<a href="/recipes/tags/rpc/">rpc</a>, <a href="/recipes/tags/testing/">testing</a>, <a href="/recipes/tags/utility_mill/">utility_mill</a>).
</p>
<p>For those of you wondering how use "utility_mill" (my previous recipe), check out "hard_test()" and "soft_test()" in this example usage. The code in the lower sections generates test data and is only useful if trying to understand the "expressions" recipe initially ported from C#. The hard test shows how easy it is to execute a utility that you know the name of. The most recent version is used, but this can be inefficient. The soft test runs the same utility once a minute but only updates the version once an hour. This can saves the Utility Mill some extra work that may not be necessary.</p>
Paratessares Time (Python)
2009-01-27T18:43:51-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/576636-paratessares-time/
<p style="color: grey">
Python
recipe 576636
by <a href="/recipes/users/2608421/">Stephen Chappell</a>
(<a href="/recipes/tags/paratessares/">paratessares</a>, <a href="/recipes/tags/tessaressunago/">tessaressunago</a>, <a href="/recipes/tags/time/">time</a>).
Revision 3.
</p>
<p>This module provides several functions that covert earth seconds into paratessares time. It is used to implement time keeping on a fictional planet and is the standard time system of Tessaressunago. It can be used as an inspiration to other people creating their own units of time or as partitioned timestamps that can be applied to records. There are four different modules listed below: the standard implementation, a unit test, and two examples. To see the Python 2.5 version of this code in action and to test out its functionality, you can go over to the Utility Mill and find Paratessares_Time in the library ( <a href="http://utilitymill.com/utility/Paratessares_Time" rel="nofollow">http://utilitymill.com/utility/Paratessares_Time</a> ).</p>