Inline calls to bit_length now that it's trivial (#3966)

* Inline calls to bit_length now that it's trivial

* unused imports

* An comment
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index 40e9285..e430e2d 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -14,7 +14,7 @@
 
 import pytest
 
-from cryptography import utils, x509
+from cryptography import x509
 from cryptography.exceptions import InternalError, _Reasons
 from cryptography.hazmat.backends.interfaces import DHBackend, RSABackend
 from cryptography.hazmat.backends.openssl.backend import (
@@ -141,10 +141,10 @@
     def test_large_key_size_on_new_openssl(self):
         parameters = dsa.generate_parameters(2048, backend)
         param_num = parameters.parameter_numbers()
-        assert utils.bit_length(param_num.p) == 2048
+        assert param_num.p.bit_length() == 2048
         parameters = dsa.generate_parameters(3072, backend)
         param_num = parameters.parameter_numbers()
-        assert utils.bit_length(param_num.p) == 3072
+        assert param_num.p.bit_length() == 3072
 
     def test_int_to_bn(self):
         value = (2 ** 4242) - 4242
diff --git a/tests/hazmat/primitives/test_dh.py b/tests/hazmat/primitives/test_dh.py
index 25be51c..a70ae74 100644
--- a/tests/hazmat/primitives/test_dh.py
+++ b/tests/hazmat/primitives/test_dh.py
@@ -13,7 +13,7 @@
     DERSerializationBackend, DHBackend, PEMSerializationBackend)
 from cryptography.hazmat.primitives import serialization
 from cryptography.hazmat.primitives.asymmetric import dh
-from cryptography.utils import bit_length, int_from_bytes
+from cryptography.utils import int_from_bytes
 
 from ...doubles import DummyKeySerializationEncryption
 from ...utils import load_nist_vectors, load_vectors_from_file
@@ -262,7 +262,7 @@
         assert isinstance(parameters, dh.DHParametersWithSerialization)
         parameter_numbers = parameters.parameter_numbers()
         assert isinstance(parameter_numbers, dh.DHParameterNumbers)
-        assert bit_length(parameter_numbers.p) == key_size
+        assert parameter_numbers.p.bit_length() == key_size
 
         assert isinstance(public, dh.DHPublicKeyWithSerialization)
         assert isinstance(public.public_numbers(), dh.DHPublicNumbers)
diff --git a/tests/hazmat/primitives/test_dsa.py b/tests/hazmat/primitives/test_dsa.py
index 3419777..89303fe 100644
--- a/tests/hazmat/primitives/test_dsa.py
+++ b/tests/hazmat/primitives/test_dsa.py
@@ -18,7 +18,6 @@
 from cryptography.hazmat.primitives.asymmetric.utils import (
     Prehashed, encode_dss_signature
 )
-from cryptography.utils import bit_length
 
 from .fixtures_dsa import (
     DSA_KEY_1024, DSA_KEY_2048, DSA_KEY_3072
@@ -82,7 +81,7 @@
         assert skey_parameters.p == vector['p']
         assert skey_parameters.q == vector['q']
         assert skey_parameters.g == vector['g']
-        assert skey.key_size == bit_length(vector['p'])
+        assert skey.key_size == vector['p'].bit_length()
         assert pkey.key_size == skey.key_size
         public_numbers = pkey.public_numbers()
         assert numbers.public_numbers.y == public_numbers.y
diff --git a/tests/test_cryptography_utils.py b/tests/test_cryptography_utils.py
index 290e161..320f7aa 100644
--- a/tests/test_cryptography_utils.py
+++ b/tests/test_cryptography_utils.py
@@ -56,3 +56,8 @@
         assert len(accesses) == 1
         assert t.t == 14
         assert len(accesses) == 1
+
+
+def test_bit_length():
+    assert utils.bit_length(1) == 1
+    assert utils.bit_length(11) == 4
diff --git a/tests/x509/test_x509.py b/tests/x509/test_x509.py
index a07ffb3..97b5a74 100644
--- a/tests/x509/test_x509.py
+++ b/tests/x509/test_x509.py
@@ -3981,4 +3981,4 @@
     assert (
         serial_number == utils.int_from_bytes(sample_data, "big") >> 1
     )
-    assert utils.bit_length(serial_number) < 160
+    assert serial_number.bit_length() < 160