[Python-checkins] python/dist/src/Lib/test test_hmac.py,1.5,1.6
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Thu, 22 Aug 2002 12:38:16 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv6538
Modified Files:
test_hmac.py
Log Message:
Standardize behavior: no docstrings in test functions; create a single
suite merging all test cases.
Index: test_hmac.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hmac.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** test_hmac.py 23 Jul 2002 19:03:54 -0000 1.5
--- test_hmac.py 22 Aug 2002 19:38:14 -0000 1.6
***************
*** 4,9 ****
class TestVectorsTestCase(unittest.TestCase):
def test_vectors(self):
! """Test the HMAC module against test vectors from the RFC."""
def md5test(key, data, digest):
--- 4,10 ----
class TestVectorsTestCase(unittest.TestCase):
+
def test_vectors(self):
! # Test the HMAC module against test vectors from the RFC.
def md5test(key, data, digest):
***************
*** 24,29 ****
class ConstructorTestCase(unittest.TestCase):
def test_normal(self):
! """Standard constructor call."""
failed = 0
try:
--- 25,31 ----
class ConstructorTestCase(unittest.TestCase):
+
def test_normal(self):
! # Standard constructor call.
failed = 0
try:
***************
*** 33,37 ****
def test_withtext(self):
! """Constructor call with text."""
try:
h = hmac.HMAC("key", "hash this!")
--- 35,39 ----
def test_withtext(self):
! # Constructor call with text.
try:
h = hmac.HMAC("key", "hash this!")
***************
*** 40,44 ****
def test_withmodule(self):
! """Constructor call with text and digest module."""
import sha
try:
--- 42,46 ----
def test_withmodule(self):
! # Constructor call with text and digest module.
import sha
try:
***************
*** 48,53 ****
class SanityTestCase(unittest.TestCase):
def test_default_is_md5(self):
! """Testing if HMAC defaults to MD5 algorithm."""
import md5
h = hmac.HMAC("key")
--- 50,56 ----
class SanityTestCase(unittest.TestCase):
+
def test_default_is_md5(self):
! # Testing if HMAC defaults to MD5 algorithm.
import md5
h = hmac.HMAC("key")
***************
*** 55,59 ****
def test_exercise_all_methods(self):
! """Exercising all methods once."""
# This must not raise any exceptions
try:
--- 58,62 ----
def test_exercise_all_methods(self):
! # Exercising all methods once.
# This must not raise any exceptions
try:
***************
*** 67,72 ****
class CopyTestCase(unittest.TestCase):
def test_attributes(self):
! """Testing if attributes are of same type."""
h1 = hmac.HMAC("key")
h2 = h1.copy()
--- 70,76 ----
class CopyTestCase(unittest.TestCase):
+
def test_attributes(self):
! # Testing if attributes are of same type.
h1 = hmac.HMAC("key")
h2 = h1.copy()
***************
*** 79,83 ****
def test_realcopy(self):
! """Testing if the copy method created a real copy."""
h1 = hmac.HMAC("key")
h2 = h1.copy()
--- 83,87 ----
def test_realcopy(self):
! # Testing if the copy method created a real copy.
h1 = hmac.HMAC("key")
h2 = h1.copy()
***************
*** 90,94 ****
def test_equality(self):
! """Testing if the copy has the same digests."""
h1 = hmac.HMAC("key")
h1.update("some random text")
--- 94,98 ----
def test_equality(self):
! # Testing if the copy has the same digests.
h1 = hmac.HMAC("key")
h1.update("some random text")
***************
*** 100,107 ****
def test_main():
! test_support.run_unittest(TestVectorsTestCase)
! test_support.run_unittest(ConstructorTestCase)
! test_support.run_unittest(SanityTestCase)
! test_support.run_unittest(CopyTestCase)
if __name__ == "__main__":
--- 104,113 ----
def test_main():
! suite = unittest.TestSuite()
! suite.addTest(unittest.makeSuite(TestVectorsTestCase))
! suite.addTest(unittest.makeSuite(ConstructorTestCase))
! suite.addTest(unittest.makeSuite(SanityTestCase))
! suite.addTest(unittest.makeSuite(CopyTestCase))
! test_support.run_suite(suite)
if __name__ == "__main__":