Skip to content
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

Drop support for Python < 3.9 #80

Merged
merged 5 commits into from
Aug 14, 2024
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.10

- name: Build distribution
run: python -m pip install build && python -m build
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e '.[test]'
- name: Test with nosetests
run: nosetests
run: pip install -e '.[test]'

- name: Run tests
run: python -m unittest
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 9.0.0

- Dropped support for Python < 3.10 (no other changes)

## 8.0.0

- Parser now accepts both strings and bytes, and will encode strings to bytes using UTF-8
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Use it like this:

## Releasing a new version

1. Run the tests with `nosetests`
1. Run the tests with `python -m unittest`
2. Update the version by changing the `__version__` variable in [`cobalt/__init__.py`](cobalt/__init__.py)
3. Commit your changes and push to the master branch on GitHub
4. Create a release in GitHub and it will automatically be pushed to PyPi
Expand Down
2 changes: 1 addition & 1 deletion cobalt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .portion import PortionStructure, Portion
from .uri import FrbrUri

__version__ = '8.0.1'
__version__ = '9.0.0'

__all__ = [
'Act', 'AkomaNtosoDocument', 'Amendment', 'AmendmentEvent', 'AmendmentList', 'AmendmentStructure',
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ authors = [
]
license = {text = "LGPLv3+"}
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.9"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand All @@ -32,7 +32,7 @@ dynamic = ["version"]
"Bug Tracker" = "https://github.com/laws-africa/cobalt/issues"

[project.optional-dependencies]
test = ["nose", "flake8"]
test = ["flake8"]

[tool.setuptools.packages.find]
include = ["cobalt"] # package names should match these glob patterns (["*"] by default)
Expand Down
45 changes: 22 additions & 23 deletions tests/test_act.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from unittest import TestCase
from nose.tools import * # noqa
from datetime import date

from lxml.etree import LxmlSyntaxError
Expand All @@ -13,45 +12,45 @@ class ActTestCase(TestCase):

def test_empty_act(self):
a = Act()
assert_equal(a.title, "Untitled")
assert_is_not_none(a.meta)
assert_is_not_none(a.body)
self.assertEqual(a.title, "Untitled")
self.assertIsNotNone(a.meta)
self.assertIsNotNone(a.body)

assert_validates(a)

def test_empty_body(self):
a = Act()
assert_not_equal(a.body.text, '')
self.assertNotEqual(a.body.text, '')
assert_validates(a)

def test_publication_date(self):
a = Act()
assert_is_none(a.publication_date)
self.assertIsNone(a.publication_date)
assert_validates(a)

a.publication_date = '2012-01-02'
assert_equal(datestring(a.publication_date), '2012-01-02')
assert_is_instance(a.publication_date, date)
self.assertEqual(datestring(a.publication_date), '2012-01-02')
self.assertIsInstance(a.publication_date, date)
assert_validates(a)

a.publication_date = None
assert_is_none(a.publication_date)
self.assertIsNone(a.publication_date)
assert_validates(a)

def test_publication_number(self):
a = Act()
assert_is_none(a.publication_number)
self.assertIsNone(a.publication_number)

a.publication_number = '1234'
assert_equal(a.publication_number, '1234')
self.assertEqual(a.publication_number, '1234')
assert_validates(a)

def test_publication_name(self):
a = Act()
assert_is_none(a.publication_name)
self.assertIsNone(a.publication_name)

a.publication_name = 'Publication'
assert_equal(a.publication_name, 'Publication')
self.assertEqual(a.publication_name, 'Publication')
assert_validates(a)

def test_set_amendments(self):
Expand Down Expand Up @@ -169,14 +168,14 @@ def test_set_amendments(self):
""", xml)

amendment = a.amendments[0]
assert_equal(datestring(amendment.date), '2012-02-01')
assert_equal(amendment.amending_uri, '/za/act/1980/22')
assert_equal(amendment.amending_title, 'Corrected')
self.assertEqual(datestring(amendment.date), '2012-02-01')
self.assertEqual(amendment.amending_uri, '/za/act/1980/22')
self.assertEqual(amendment.amending_title, 'Corrected')

amendment = a.amendments[1]
assert_equal(datestring(amendment.date), '2013-03-03')
assert_equal(amendment.amending_uri, '/za/act/1990/5')
assert_equal(amendment.amending_title, 'Bar')
self.assertEqual(datestring(amendment.date), '2013-03-03')
self.assertEqual(amendment.amending_uri, '/za/act/1990/5')
self.assertEqual(amendment.amending_title, 'Bar')

assert_validates(a)

Expand Down Expand Up @@ -283,15 +282,15 @@ def test_set_repeal(self):
</akomaNtoso>
""", xml)

assert_equal(a.repeal.repealing_uri, '/za/act/1980/10')
assert_equal(a.repeal.repealing_title, 'Foo')
assert_equal(datestring(a.repeal.date), '2012-02-01')
self.assertEqual(a.repeal.repealing_uri, '/za/act/1980/10')
self.assertEqual(a.repeal.repealing_title, 'Foo')
self.assertEqual(datestring(a.repeal.date), '2012-02-01')

assert_validates(a)

# check that clearing it works
a.repeal = None
assert_is_none(a.repeal)
self.assertIsNone(a.repeal)

assert_validates(a)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_attachments.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from unittest import TestCase
from nose.tools import * # noqa

from lxml import etree

from cobalt import Act
from cobalt.schemas import assert_validates


class AttachmentsTestCase(TestCase):
maxDiff = None

Expand Down
21 changes: 21 additions & 0 deletions tests/test_debate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from unittest import TestCase

from cobalt import Debate


class DebateTestCase(TestCase):
maxDiff = None

def test_empty_debate(self):
d = Debate()
self.assertEqual(d.title, "Untitled")
self.assertIsNotNone(d.meta)
self.assertIsNotNone(d.debateBody)

def test_empty_body(self):
d = Debate()
self.assertNotEqual(d.debateBody.text, '')

def test_main(self):
d = Debate()
self.assertEqual(d.main, d.debate)
9 changes: 4 additions & 5 deletions tests/test_judgment.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from unittest import TestCase
from nose.tools import * # noqa

from cobalt import Judgment

Expand All @@ -9,13 +8,13 @@ class JudgmentTestCase(TestCase):

def test_empty_judgment(self):
j = Judgment()
assert_equal(j.title, "Untitled")
assert_is_not_none(j.meta)
assert_is_not_none(j.judgmentBody)
self.assertEqual(j.title, "Untitled")
self.assertIsNotNone(j.meta)
self.assertIsNotNone(j.judgmentBody)

def test_empty_body(self):
j = Judgment()
assert_not_equal(j.judgmentBody.text, '')
self.assertNotEqual(j.judgmentBody.text, '')

def test_main(self):
j = Judgment()
Expand Down
Loading
Loading