[pypy-commit] pypy py3.3-fixes3: add tests for .name attribute on sha objects

numerodix noreply at buildbot.pypy.org
Mon Aug 18 01:05:47 CEST 2014


Author: Martin Matusiak <numerodix at gmail.com>
Branch: py3.3-fixes3
Changeset: r72863:51ec894e3d52
Date: 2014-08-17 20:17 +0200
http://bitbucket.org/pypy/pypy/changeset/51ec894e3d52/

Log:	add tests for .name attribute on sha objects

diff --git a/pypy/module/test_lib_pypy/test_sha_extra.py b/pypy/module/test_lib_pypy/test_sha_extra.py
--- a/pypy/module/test_lib_pypy/test_sha_extra.py
+++ b/pypy/module/test_lib_pypy/test_sha_extra.py
@@ -37,3 +37,30 @@
         assert _sha.sha1().digest_size == 20
         assert _sha.sha1().digestsize == 20
         assert _sha.sha1().block_size == 64
+
+        assert _sha.sha().name == 'sha'
+        assert _sha.sha1().name == 'sha1'
+
+
+class AppTestSHA256:
+    spaceconfig = dict(usemodules=('struct',))
+
+    def setup_class(cls):
+        cls.w__sha256 = import_lib_pypy(cls.space, '_sha256')
+
+    def test_attributes(self):
+        _sha256 = self._sha256
+        assert _sha256.sha224().name == 'sha224'
+        assert _sha256.sha256().name == 'sha256'
+
+
+class AppTestSHA512:
+    spaceconfig = dict(usemodules=('struct',))
+
+    def setup_class(cls):
+        cls.w__sha512 = import_lib_pypy(cls.space, '_sha512')
+
+    def test_attributes(self):
+        _sha512 = self._sha512
+        assert _sha512.sha384().name == 'sha384'
+        assert _sha512.sha512().name == 'sha512'


More information about the pypy-commit mailing list