Skip to content

Commit 80f37e9

Browse files
committed
Initializing (by setting to None)...
...the attributes: `expand.global_name_pattern` and `expand.global_name_formatter`. Plus several dosc updates/improvements/fixes...
1 parent bf4c108 commit 80f37e9

File tree

4 files changed

+48
-9
lines changed

4 files changed

+48
-9
lines changed

CHANGES.rst

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
Changes
22
=======
33

4+
Unreleased (to be updated...)
5+
-----------------------------
6+
7+
* A minor interface usability fix: from now on, the **expand()**
8+
decorator's attributes **global_name_pattern** and
9+
**global_name_formatter** are both initially set to **None**
10+
(previously, by default, they were not initialized at all, so
11+
trying to get any of them without first setting it caused an
12+
**AttributeError**).
13+
14+
* Documentation: several updates and minor fixes/improvements.
15+
16+
417
0.4.1 (2023-03-17)
518
------------------
619

7-
* Added the **unittest_expander.__version__** global constant.
20+
* Added the **__version__** constant to the **unittest_expander** module.
821

9-
* improvements and additions related to tests, CI, generation of
22+
* Improvements and additions related to tests, CI, generation of
1023
documentation, etc.; in particular: added a script that checks whether
11-
*unittest_expander.__version__** is equal to **version** in package
24+
**unittest_expander.__version__** is equal to **version** in package
1225
metadata, and added invocation of that script to the *Install and
1326
Test* GitHub workflow.
1427

@@ -159,7 +172,7 @@ Changes
159172
------------------
160173

161174
* Improved signatures of the **foreach()** decorator and the
162-
**paramseq** constructor: they take either exactly one positional
175+
**paramseq()** constructor: they take either exactly one positional
163176
argument which must be a test parameter collection (as previously: a
164177
sequence/mapping/set or a **paramseq** instance, or a callable
165178
returning an iterable...), or *any number of positional and/or keyword
@@ -196,7 +209,7 @@ Changes
196209
0.1.2 (2014-08-01)
197210
------------------
198211

199-
* The signatures of the **foreach()** decorator and the **paramseq**
212+
* The signatures of the **foreach()** decorator and the **paramseq()**
200213
constructor have been unified.
201214

202215
* Tests/documentation-related updates and improvements.

docs/reference.rst

+17-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Module Contents
44
.. module:: unittest_expander
55

66
The module :mod:`unittest_expander`'s public interface consists of the
7-
following functions and classes.
7+
following functions, classes and constants.
88

99
(See: :doc:`narrative_documentation` -- for a much richer description of
10-
them, including a lot of usage examples...)
10+
most of them, including a lot of usage examples...)
1111

1212

1313
The :func:`expand` class decorator
@@ -38,8 +38,12 @@ The :func:`expand` class decorator
3838

3939
.. attribute:: expand.global_name_pattern
4040

41+
:value: None
42+
4143
.. attribute:: expand.global_name_formatter
4244

45+
:value: None
46+
4347

4448
The :func:`foreach` method/class decorator
4549
------------------------------------------
@@ -248,3 +252,14 @@ The :class:`Substitute` class
248252
.. attribute:: actual_object
249253

250254
The proxied object itself (unwrapped).
255+
256+
257+
The :data:`__version__` constant
258+
--------------------------------
259+
260+
.. data:: __version__
261+
262+
The version of :mod:`unittest_expander` as a :pep:`440`-compliant
263+
identifier.
264+
265+
:type: str

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = unittest_expander
3-
version = 0.4.1
3+
version = 0.4.2.dev0
44
description = Easy and flexible unit test parametrization
55
long_description = file: README.rst
66
long_description_content_type = text/x-rst

unittest_expander.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -1748,6 +1748,14 @@
17481748
Python standard library (or to any object whose :meth:`format`
17491749
method acts similarily to :meth:`string.Formatter.format`).
17501750
1751+
.. doctest::
1752+
:hide:
1753+
1754+
>>> expand.global_name_pattern is None
1755+
True
1756+
>>> expand.global_name_formatter is None
1757+
True
1758+
17511759
For example:
17521760
17531761
>>> expand.global_name_pattern = '{base_name}__parametrized_{count}'
@@ -2687,7 +2695,7 @@
26872695
'Substitute',
26882696
)
26892697

2690-
__version__ = '0.4.1'
2698+
__version__ = '0.4.2.dev0'
26912699

26922700

26932701
_CLASS_TYPES = (type,) if _PY3 else (type, types.ClassType)
@@ -3039,6 +3047,9 @@ def expand(test_cls=None, **kwargs):
30393047
_expand_test_methods(test_cls)
30403048
return _expand_test_cls(test_cls, into)
30413049

3050+
expand.global_name_pattern = None
3051+
expand.global_name_formatter = None
3052+
30423053

30433054
def _expand_test_methods(test_cls):
30443055
attrs_to_substitute, attrs_to_add = _get_attrs_to_substitute_and_add(test_cls)

0 commit comments

Comments
 (0)