1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
|
%global _empty_manifest_terminate_build 0
Name: python-pytruth
Version: 1.1.0
Release: 1
Summary: Provides unittest assertions in a fluent style.
License: Apache 2.0
URL: https://github.com/google/pytruth
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/24/61/2fc9a9cc1144c9123c053741cbf3f19e9213cdf658fef5f993b025e44c29/pytruth-1.1.0.tar.gz
BuildArch: noarch
Requires: python3-six
Requires: python3-wheel
%description
# PyTruth: Truth in Python
[![Development Status][development-shield]][development-link]
[![Build Status][travis-shield]][travis-link]
[![PyPI Version][pypi-shield]][pypi-link]
[![Python Versions][pyversions-shield]][pyversions-link]
Provides unittest assertions in a fluent style.
Translated from the Java implementation,
[google/truth](https://github.com/google/truth).
## License
PyTruth is licensed under the [Apache 2.0 license](LICENSE).
## Disclaimer
PyTruth is not an official Google product.
## Contributing
Please see the [guidelines for contributing](CONTRIBUTING.md)
before creating pull requests.
## Support
PyTruth is not an actively maintained project. No support is provided.
It is shared with the community to bring an expressive, consistent assertion
style to projects that may be using a combination of
[unittest](https://docs.python.org/3/library/unittest.html),
[abseil](https://github.com/abseil/abseil-py),
[googletest](https://github.com/google/googletest),
[mox](https://pypi.python.org/pypi/mox), and
[mock](https://docs.python.org/3/library/unittest.mock.html)—especially
to people familiar with [Java Truth](https://github.com/google/truth).
User group:
[pytruth-users@googlegroups.com](https://groups.google.com/d/forum/pytruth-users)
### Installing
PyTruth can be installed using [pip](https://pypi.org/project/pip/):
```bash
pip install pytruth
```
## Overview
Import the `truth` module and alias the `AssertThat()` method to begin asserting
things:
```python
from truth.truth import AssertThat
```
Then, instead of writing
```python
self.assertEqual(a, b)
self.assertTrue(c)
self.assertIn(a, d)
self.assertTrue(a in d and b in d)
self.assertTrue(a in d or b in d or c in d)
with self.assertRaises(Error):
Explode()
```
one would write
```python
AssertThat(a).IsEqualTo(b)
AssertThat(c).IsTrue()
AssertThat(d).Contains(a)
AssertThat(d).ContainsAllOf(a, b)
AssertThat(d).ContainsAnyOf(a, b, c)
with AssertThat(Error).IsRaised():
Explode()
```
Tests should be easier to read and write, and flow more clearly.
## Limitations
unittest assertions accept a `msg` parameter to display if the assertion fails.
PyTruth has no such mechanism, though its failure messages tend to be more
informative.
The type of the subject under test (the parameter passed to `AssertThat()`) will
not be known until runtime, unlike Java where the type is known at compile time.
IDEs may not correctly autocomplete available predicates on an asserted subject.
In Python 2, `None` compares less than every other thing, except `None` itself.
`None` is less than `nan`, and it is less than negative infinity. Therefore, use
caution when a function might return `None`. The assertion
`AssertThat(Func()).IsLessThan(0)` succeeds whether `Func()` returns a negative
number or `None`. Instead, first check the `None`-ness of the return value with
`IsNone()` or `IsNotNone()` before performing an inequality assertion.
In Python 3, `None` is no longer comparable using `<` `>` `<=` `>=`.
PyTruth detects the version of the Python interpreter and compares or fails
appropriately, rather than allowing Python 3's `TypeError` to bubble up.
If the iterator over a shared value (either expected or actual) changes that
value or its underlying elements, the behavior is undefined:
all, none, or some of the assertions may succeed or fail, arbitrarily.
This library is threadsafe; you may execute multiple assertions in parallel.
## Conversion Recipes
### General
%package -n python3-pytruth
Summary: Provides unittest assertions in a fluent style.
Provides: python-pytruth
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-pytruth
# PyTruth: Truth in Python
[![Development Status][development-shield]][development-link]
[![Build Status][travis-shield]][travis-link]
[![PyPI Version][pypi-shield]][pypi-link]
[![Python Versions][pyversions-shield]][pyversions-link]
Provides unittest assertions in a fluent style.
Translated from the Java implementation,
[google/truth](https://github.com/google/truth).
## License
PyTruth is licensed under the [Apache 2.0 license](LICENSE).
## Disclaimer
PyTruth is not an official Google product.
## Contributing
Please see the [guidelines for contributing](CONTRIBUTING.md)
before creating pull requests.
## Support
PyTruth is not an actively maintained project. No support is provided.
It is shared with the community to bring an expressive, consistent assertion
style to projects that may be using a combination of
[unittest](https://docs.python.org/3/library/unittest.html),
[abseil](https://github.com/abseil/abseil-py),
[googletest](https://github.com/google/googletest),
[mox](https://pypi.python.org/pypi/mox), and
[mock](https://docs.python.org/3/library/unittest.mock.html)—especially
to people familiar with [Java Truth](https://github.com/google/truth).
User group:
[pytruth-users@googlegroups.com](https://groups.google.com/d/forum/pytruth-users)
### Installing
PyTruth can be installed using [pip](https://pypi.org/project/pip/):
```bash
pip install pytruth
```
## Overview
Import the `truth` module and alias the `AssertThat()` method to begin asserting
things:
```python
from truth.truth import AssertThat
```
Then, instead of writing
```python
self.assertEqual(a, b)
self.assertTrue(c)
self.assertIn(a, d)
self.assertTrue(a in d and b in d)
self.assertTrue(a in d or b in d or c in d)
with self.assertRaises(Error):
Explode()
```
one would write
```python
AssertThat(a).IsEqualTo(b)
AssertThat(c).IsTrue()
AssertThat(d).Contains(a)
AssertThat(d).ContainsAllOf(a, b)
AssertThat(d).ContainsAnyOf(a, b, c)
with AssertThat(Error).IsRaised():
Explode()
```
Tests should be easier to read and write, and flow more clearly.
## Limitations
unittest assertions accept a `msg` parameter to display if the assertion fails.
PyTruth has no such mechanism, though its failure messages tend to be more
informative.
The type of the subject under test (the parameter passed to `AssertThat()`) will
not be known until runtime, unlike Java where the type is known at compile time.
IDEs may not correctly autocomplete available predicates on an asserted subject.
In Python 2, `None` compares less than every other thing, except `None` itself.
`None` is less than `nan`, and it is less than negative infinity. Therefore, use
caution when a function might return `None`. The assertion
`AssertThat(Func()).IsLessThan(0)` succeeds whether `Func()` returns a negative
number or `None`. Instead, first check the `None`-ness of the return value with
`IsNone()` or `IsNotNone()` before performing an inequality assertion.
In Python 3, `None` is no longer comparable using `<` `>` `<=` `>=`.
PyTruth detects the version of the Python interpreter and compares or fails
appropriately, rather than allowing Python 3's `TypeError` to bubble up.
If the iterator over a shared value (either expected or actual) changes that
value or its underlying elements, the behavior is undefined:
all, none, or some of the assertions may succeed or fail, arbitrarily.
This library is threadsafe; you may execute multiple assertions in parallel.
## Conversion Recipes
### General
%package help
Summary: Development documents and examples for pytruth
Provides: python3-pytruth-doc
%description help
# PyTruth: Truth in Python
[![Development Status][development-shield]][development-link]
[![Build Status][travis-shield]][travis-link]
[![PyPI Version][pypi-shield]][pypi-link]
[![Python Versions][pyversions-shield]][pyversions-link]
Provides unittest assertions in a fluent style.
Translated from the Java implementation,
[google/truth](https://github.com/google/truth).
## License
PyTruth is licensed under the [Apache 2.0 license](LICENSE).
## Disclaimer
PyTruth is not an official Google product.
## Contributing
Please see the [guidelines for contributing](CONTRIBUTING.md)
before creating pull requests.
## Support
PyTruth is not an actively maintained project. No support is provided.
It is shared with the community to bring an expressive, consistent assertion
style to projects that may be using a combination of
[unittest](https://docs.python.org/3/library/unittest.html),
[abseil](https://github.com/abseil/abseil-py),
[googletest](https://github.com/google/googletest),
[mox](https://pypi.python.org/pypi/mox), and
[mock](https://docs.python.org/3/library/unittest.mock.html)—especially
to people familiar with [Java Truth](https://github.com/google/truth).
User group:
[pytruth-users@googlegroups.com](https://groups.google.com/d/forum/pytruth-users)
### Installing
PyTruth can be installed using [pip](https://pypi.org/project/pip/):
```bash
pip install pytruth
```
## Overview
Import the `truth` module and alias the `AssertThat()` method to begin asserting
things:
```python
from truth.truth import AssertThat
```
Then, instead of writing
```python
self.assertEqual(a, b)
self.assertTrue(c)
self.assertIn(a, d)
self.assertTrue(a in d and b in d)
self.assertTrue(a in d or b in d or c in d)
with self.assertRaises(Error):
Explode()
```
one would write
```python
AssertThat(a).IsEqualTo(b)
AssertThat(c).IsTrue()
AssertThat(d).Contains(a)
AssertThat(d).ContainsAllOf(a, b)
AssertThat(d).ContainsAnyOf(a, b, c)
with AssertThat(Error).IsRaised():
Explode()
```
Tests should be easier to read and write, and flow more clearly.
## Limitations
unittest assertions accept a `msg` parameter to display if the assertion fails.
PyTruth has no such mechanism, though its failure messages tend to be more
informative.
The type of the subject under test (the parameter passed to `AssertThat()`) will
not be known until runtime, unlike Java where the type is known at compile time.
IDEs may not correctly autocomplete available predicates on an asserted subject.
In Python 2, `None` compares less than every other thing, except `None` itself.
`None` is less than `nan`, and it is less than negative infinity. Therefore, use
caution when a function might return `None`. The assertion
`AssertThat(Func()).IsLessThan(0)` succeeds whether `Func()` returns a negative
number or `None`. Instead, first check the `None`-ness of the return value with
`IsNone()` or `IsNotNone()` before performing an inequality assertion.
In Python 3, `None` is no longer comparable using `<` `>` `<=` `>=`.
PyTruth detects the version of the Python interpreter and compares or fails
appropriately, rather than allowing Python 3's `TypeError` to bubble up.
If the iterator over a shared value (either expected or actual) changes that
value or its underlying elements, the behavior is undefined:
all, none, or some of the assertions may succeed or fail, arbitrarily.
This library is threadsafe; you may execute multiple assertions in parallel.
## Conversion Recipes
### General
%prep
%autosetup -n pytruth-1.1.0
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-pytruth -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Tue Apr 25 2023 Python_Bot <Python_Bot@openeuler.org> - 1.1.0-1
- Package Spec generated
|