from unittest import TestCase, main
from base64 import b16encode
import doctest

from tomcrypt import prng

from . import get_doctests


def load_tests(loader, tests, ignore):
    tests.addTests(get_doctests(prng))
    return tests


class TestPRNG(TestCase):
    
    def test_library(self):
        prng.test_library()

    def test_seeds(self):
        
        x = prng.fortuna()
        x.add_entropy(b'12345678')
        # print x.read(16).encode('hex')
        assert b16encode(x.read(16)).lower() == b'b1f2630e4b56ff6f1e0e5d6f1324a10d'
        
        x = prng.rc4()
        x.add_entropy(b'12345678')
        # print x.read(16).encode('hex')
        assert b16encode(x.read(16)).lower() == b'0a015ada42e721c8ee3d57a0b519a9a8'
        
        x = prng.sober128()
        x.add_entropy(b'12345678')
        # print x.read(16).encode('hex')
        assert b16encode(x.read(16)).lower() == b'39e10e5ccaa9a24c26abaf73dbf2e3f6'
        
        x = prng.yarrow()
        x.add_entropy(b'12345678')
        # print x.read(16).encode('hex')
        assert b16encode(x.read(16)).lower() == b'f63c36f72ad5098e42ac002243d2cce2'


if __name__ == '__main__':
    main()

@@ -424,49 +424,37 @@
     
-# print x.read(16).encode('hex')%0A
+self.assertEqual(%0A   
         
 asse
@@ -441,38 +441,32 @@
 ual(%0A           
-assert
  b16encode(x.rea
@@ -479,19 +479,29 @@
 .lower()
- ==
+,%0A           
  b'b1f26
@@ -529,16 +529,26 @@
 24a10d'%0A
+        )%0A
         
@@ -618,49 +618,37 @@
     
-# print x.read(16).encode('hex')%0A
+self.assertEqual(%0A   
         
 asse
@@ -635,38 +635,32 @@
 ual(%0A           
-assert
  b16encode(x.rea
@@ -673,19 +673,29 @@
 .lower()
- ==
+,%0A           
  b'0a015
@@ -723,16 +723,26 @@
 19a9a8'%0A
+        )%0A
         
@@ -817,49 +817,37 @@
     
-# print x.read(16).encode('hex')%0A
+self.assertEqual(%0A   
         
 asse
@@ -834,38 +834,32 @@
 ual(%0A           
-assert
  b16encode(x.rea
@@ -872,19 +872,29 @@
 .lower()
- ==
+,%0A           
  b'39e10
@@ -922,16 +922,26 @@
 f2e3f6'%0A
+        )%0A
         
@@ -1014,49 +1014,37 @@
     
-# print x.read(16).encode('hex')%0A
+self.assertEqual(%0A   
         
 asse
@@ -1039,22 +1039,16 @@
         
-assert
  b16enco
@@ -1069,19 +1069,29 @@
 .lower()
- ==
+,%0A           
  b'f63c3
@@ -1119,16 +1119,26 @@
 d2cce2'%0A
+        )%0A
 %0A%0Aif __n

Use assertEquals instead of assert