Move some shared logic to functions

Pulled from #1116
I thought our conclusion was that you should be able to put any integers in
a Numbers instance, and they were validated on load?


On Wed, Jun 11, 2014 at 9:12 PM, Paul Kehrer <notifications@github.com>
wrote:

> In tests/hazmat/primitives/test_rsa.py:
>
> > @@ -1713,7 +1713,7 @@ def test_public_numbers_invalid_types(self):
> >              rsa.RSAPublicNumbers(e=1, n=None)
> >
> >      def test_private_numbers_invalid_types(self):
> > -        public_numbers = rsa.RSAPublicNumbers(e=1, n=15)
> > +        public_numbers = rsa.RSAPublicNumbers(e=3, n=15)
>
> The test is supposed to fail on private_numbers, but since this PR
> actually enforces sanity inside RSAPublicNumbers e=1 (correctly) causes a
> ValueError. It worked previously because we weren't checking anything
> other than whether you were passing integers.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/pyca/cryptography/pull/1125/files#r13686946>.
>



-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: 125F 5C67 DFE9 4084