Exemplo n.º 1
0
 def test_pickle(self):
     import pickle
     
     p1 = findprimes.findPrimes(123)
     
     with open("primes.dat", "wb") as of:
         pickle.dump(p1, of)
     # no need of.close(), because with clause handles it
     
     with open("primes.dat", "rb") as inf:
         p2 = pickle.load(inf)
     # inf.close() see above close statement
     
     self.assertEquals (p1,p2)
Exemplo n.º 2
0
 def test_findPrimes (self):
     self.assertEqual(findprimes.findPrimes(4), self.upto4)