commit: d8bec276e6a0090155a654ab655cf3231d306780
Author: Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Sun Dec 14 16:23:20 2025 +0000
Commit: Brian Harring <ferringb <AT> gmail <DOT> com>
CommitDate: Mon Dec 15 12:42:10 2025 +0000
URL:
https://gitweb.gentoo.org/proj/pkgcore/snakeoil.git/commit/?id=d8bec276
chore: update deprecation tests for formatting changes
Signed-off-by: Brian Harring <ferringb <AT> gmail.com>
src/snakeoil/deprecation/__init__.py | 5 ++++-
tests/test_deprecation.py | 16 ++++++----------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/snakeoil/deprecation/__init__.py
b/src/snakeoil/deprecation/__init__.py
index dc985f6..5feae6e 100644
--- a/src/snakeoil/deprecation/__init__.py
+++ b/src/snakeoil/deprecation/__init__.py
@@ -159,7 +159,10 @@ class Record:
yield "removal in python=" + (".".join(map(str,
self.removal_in_python)))
def __str__(self) -> str:
- return ", ".join(self._collect_strings())
+ i = self._collect_strings()
+ thing = next(i)
+ rest = ", ".join(i)
+ return f"{thing}: {rest}"
class RecordNote(Record):
diff --git a/tests/test_deprecation.py b/tests/test_deprecation.py
index 83d667b..1821560 100644
--- a/tests/test_deprecation.py
+++ b/tests/test_deprecation.py
@@ -10,6 +10,7 @@ from snakeoil.deprecation import (
Record,
RecordCallable,
RecordModule,
+ RecordNote,
Registry,
suppress_deprecations,
)
@@ -177,7 +178,7 @@ class TestRegistry:
)
assert 1 == len(r)
assert (
- Record("asdf", removal_in=(1, 0, 0), removal_in_python=(2, 0, 0))
+ RecordNote("asdf", removal_in=(1, 0, 0), removal_in_python=(2, 0,
0))
== list(r)[0]
)
@@ -296,23 +297,18 @@ class TestRegistry:
def test_RecordModule_str():
- assert "module='foon.blah', removal in python=3.0.2, reason: why not" ==
str(
+ assert "foon.blah: why not, removal in python=3.0.2" == str(
RecordModule("why not", qualname="foon.blah", removal_in_python=(3, 0,
2))
)
def test_Record_str():
- assert "removal in version=1.0.2, removal in python=3.0.2, reason: blah"
== str(
+ assert "blah: removal in version=1.0.2, removal in python=3.0.2" == str(
Record("blah", removal_in=(1, 0, 2), removal_in_python=(3, 0, 2))
)
def test_RecordCallable_str():
- assert (
- "qualname='snakeoil.blah.foon', removal in version=2.0.3, reason: I
said so"
- == str(
- RecordCallable(
- "I said so", qualname="snakeoil.blah.foon", removal_in=(2, 0,
3)
- )
- )
+ assert "snakeoil.blah.foon: I said so, removal in version=2.0.3" == str(
+ RecordCallable("I said so", qualname="snakeoil.blah.foon",
removal_in=(2, 0, 3))
)