diff --git a/docs/conf.py b/docs/conf.py index bd06f9c..822245d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # bitstruct documentation build configuration file, created by # sphinx-quickstart on Sat Apr 25 11:54:09 2015. @@ -19,7 +18,7 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath('..')) +sys.path.insert(0, os.path.abspath("../src")) import bitstruct @@ -51,9 +50,9 @@ master_doc = 'index' # General information about the project. -project = u'bitstruct' -copyright = u'2015-2019, Erik Moqvist' -author = u'Erik Moqvist' +project = 'bitstruct' +copyright = '2015-2019, Erik Moqvist' +author = 'Erik Moqvist' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -227,8 +226,8 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'bitstruct.tex', u'bitstruct Documentation', - u'Erik Moqvist', 'manual'), + (master_doc, 'bitstruct.tex', 'bitstruct Documentation', + 'Erik Moqvist', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -257,7 +256,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'bitstruct', u'bitstruct Documentation', + (master_doc, 'bitstruct', 'bitstruct Documentation', [author], 1) ] @@ -271,7 +270,7 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'bitstruct', u'bitstruct Documentation', + (master_doc, 'bitstruct', 'bitstruct Documentation', author, 'bitstruct', 'One line description of project.', 'Miscellaneous'), ] diff --git a/pyproject.toml b/pyproject.toml index 964835c..8d3ed67 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ description = """This module performs conversions between Python values \ and C bit field structs represented as Python \ byte strings.""" readme = "README.rst" -requires-python = ">=3.7" +requires-python = ">=3.8" license = { text = "MIT" } keywords = [ "bit field", diff --git a/tests/test_bitstruct.py b/tests/test_bitstruct.py index 9504488..6dbf9c8 100644 --- a/tests/test_bitstruct.py +++ b/tests/test_bitstruct.py @@ -1,6 +1,4 @@ -from __future__ import print_function import sys -import timeit import unittest from bitstruct import * import bitstruct @@ -57,7 +55,7 @@ def test_pack(self): packed = pack('u5b2u1', 31, False, 1) self.assertEqual(packed, b'\xf9') - packed = pack('b1t24', False, u'Hi!') + packed = pack('b1t24', False, 'Hi!') self.assertEqual(packed, b'$4\x90\x80') packed = pack('b1t24', False, 'Hi!') @@ -66,9 +64,8 @@ def test_pack(self): packed = pack('t8000', 1000 * '7') self.assertEqual(packed, 1000 * b'\x37') - if sys.version_info >= (3, 6): - packed = pack('f16', 1.0) - self.assertEqual(packed, b'\x3c\x00') + packed = pack('f16', 1.0) + self.assertEqual(packed, b'\x3c\x00') packed = pack('f32', 1.0) self.assertEqual(packed, b'\x3f\x80\x00\x00') @@ -179,7 +176,7 @@ def test_unpack(self): packed = b'$4\x90\x80' unpacked = unpack('b1t24', packed) - self.assertEqual(unpacked, (False, u'Hi!')) + self.assertEqual(unpacked, (False, 'Hi!')) packed = 1000 * b'7' unpacked = unpack('t8000', packed) @@ -236,10 +233,9 @@ def test_pack_unpack(self): unpacked = unpack('f64', packed) self.assertEqual(unpacked, (1.0, )) - if sys.version_info >= (3, 6): - packed = pack('f16', 1.0) - unpacked = unpack('f16', packed) - self.assertEqual(unpacked, (1.0, )) + packed = pack('f16', 1.0) + unpacked = unpack('f16', packed) + self.assertEqual(unpacked, (1.0, )) def test_calcsize(self): """Calculate size. diff --git a/tests/test_c.py b/tests/test_c.py index e72bf3b..c8ee5c9 100644 --- a/tests/test_c.py +++ b/tests/test_c.py @@ -1,6 +1,4 @@ -from __future__ import print_function import sys -import timeit import pickle import unittest import platform @@ -83,7 +81,7 @@ def test_pack(self): packed = pack('u5b2u1', 31, False, 1) self.assertEqual(packed, b'\xf9') - packed = pack('b1t24', False, u'Hi!') + packed = pack('b1t24', False, 'Hi!') self.assertEqual(packed, b'$4\x90\x80') packed = pack('b1t24', False, 'Hi!') @@ -92,9 +90,8 @@ def test_pack(self): packed = pack('t8000', 1000 * '7') self.assertEqual(packed, 1000 * b'\x37') - if sys.version_info >= (3, 6): - packed = pack('f16', 1.0) - self.assertEqual(packed, b'\x3c\x00') + packed = pack('f16', 1.0) + self.assertEqual(packed, b'\x3c\x00') packed = pack('f32', 1.0) self.assertEqual(packed, b'\x3f\x80\x00\x00') @@ -176,15 +173,14 @@ def test_unpack(self): packed = b'$4\x90\x80' unpacked = unpack('b1t24', packed) - self.assertEqual(unpacked, (False, u'Hi!')) + self.assertEqual(unpacked, (False, 'Hi!')) packed = 1000 * b'7' unpacked = unpack('t8000', packed) self.assertEqual(packed, 1000 * b'\x37') - if sys.version_info >= (3, 6): - unpacked = unpack('f16', b'\x3c\x00') - self.assertEqual(unpacked, (1.0, )) + unpacked = unpack('f16', b'\x3c\x00') + self.assertEqual(unpacked, (1.0, )) unpacked = unpack('f32', b'\x3f\x80\x00\x00') self.assertEqual(unpacked, (1.0, )) @@ -225,10 +221,9 @@ def test_pack_unpack(self): unpacked = unpack('f64', packed) self.assertEqual(unpacked, (1.0, )) - if sys.version_info >= (3, 6): - packed = pack('f16', 1.0) - unpacked = unpack('f16', packed) - self.assertEqual(unpacked, (1.0, )) + packed = pack('f16', 1.0) + unpacked = unpack('f16', packed) + self.assertEqual(unpacked, (1.0, )) def test_calcsize(self): """Calculate size. @@ -618,10 +613,7 @@ def test_various(self): with self.assertRaises(NotImplementedError) as cm: pack('f1', 1.0) - if sys.version_info >= (3, 6): - self.assertEqual(str(cm.exception), 'Float not 16, 32 or 64 bits.') - else: - self.assertEqual(str(cm.exception), 'Float not 32 or 64 bits.') + self.assertEqual(str(cm.exception), 'Float not 16, 32 or 64 bits.') # Long bool. with self.assertRaises(NotImplementedError) as cm: