requiresthat 2025.6.20.0__tar.gz → 2025.6.21.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: requiresthat
3
- Version: 2025.6.20.0
3
+ Version: 2025.6.21.0
4
4
  Summary: Support for requirements-assisted development
5
5
  Author-email: Ann T Ropea <bedhanger@gmx.de>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "requiresthat"
7
- version = "2025.6.20.0"
7
+ version = "2025.6.21.0"
8
8
  authors = [
9
9
  {name = "Ann T Ropea", email = "bedhanger@gmx.de"},
10
10
  ]
@@ -80,8 +80,14 @@ def __assert(self, that, when: When, subwhen: str = str()):
80
80
  The reason we don't use assert here is to avoid the Knuthian dilemma of premature optimisation;
81
81
  namely, that it nukes this useful tool, :-[
82
82
  """
83
+ # We map everything that can go wrong to one exception; that way, the user has to deal with only
84
+ # one catagory of exceptions.
85
+ failure = RequirementNotFulfilledError(that, when, subwhen)
83
86
  try:
84
87
  if not eval(that):
85
- raise RequirementNotFulfilledError(that, when, subwhen) from None
88
+ raise failure from None
86
89
  except:
87
- raise RequirementNotFulfilledError(that, when, subwhen) from None
90
+ raise failure from None
91
+ else:
92
+ # Success!
93
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: requiresthat
3
- Version: 2025.6.20.0
3
+ Version: 2025.6.21.0
4
4
  Summary: Support for requirements-assisted development
5
5
  Author-email: Ann T Ropea <bedhanger@gmx.de>
6
6
  License-Expression: MIT
@@ -106,3 +106,23 @@ class TestCase_requiresthat_01:
106
106
 
107
107
  X = C(data='spam')
108
108
  X.method()
109
+
110
+ @pytest.mark.filterwarnings("ignore::SyntaxWarning")
111
+ def test_the_impossible(self):
112
+ """Make the evaluation itself a problem"""
113
+
114
+ # In algebraic wheels, div by zero is meaningful: https://en.wikipedia.org/wiki/Wheel_theory
115
+ # In Python wheels, it is not!
116
+ the_impossible = '1 / 0 is not None'
117
+ class C:
118
+
119
+ def __init__(self, data=None):
120
+ self.data = data
121
+
122
+ @requires(the_impossible)
123
+ def method(self):
124
+ self.data = 'ham'
125
+
126
+ X = C(data='spam')
127
+ with pytest.raises(RequirementNotFulfilledError):
128
+ X.method()