File: test_parallel.py

package info (click to toggle)
python-rsa 4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 308 kB
  • sloc: python: 2,053; makefile: 9
file content (20 lines) | stat: -rw-r--r-- 501 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""Test for multiprocess prime generation."""

import unittest

import rsa.prime
import rsa.parallel
import rsa.common


class ParallelTest(unittest.TestCase):
    """Tests for multiprocess prime generation."""

    def test_parallel_primegen(self):
        p = rsa.parallel.getprime(1024, 3)

        self.assertFalse(rsa.prime.is_prime(p - 1))
        self.assertTrue(rsa.prime.is_prime(p))
        self.assertFalse(rsa.prime.is_prime(p + 1))

        self.assertEqual(1024, rsa.common.bit_size(p))