Skip to content

drop python<=3.7 support #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# bitstruct documentation build configuration file, created by
# sphinx-quickstart on Sat Apr 25 11:54:09 2015.
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
]

Expand All @@ -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'),
]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 7 additions & 11 deletions tests/test_bitstruct.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from __future__ import print_function
import sys
import timeit
import unittest
from bitstruct import *
import bitstruct
Expand Down Expand Up @@ -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!')
Expand All @@ -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')
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down
28 changes: 10 additions & 18 deletions tests/test_c.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from __future__ import print_function
import sys
import timeit
import pickle
import unittest
import platform
Expand Down Expand Up @@ -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!')
Expand All @@ -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')
Expand Down Expand Up @@ -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, ))
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
Loading