diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-10 09:25:49 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-10 09:25:49 +0000 |
commit | b4e1e3f6352e4de134c430012193a8603285aaaa (patch) | |
tree | 2d437a52c605b11d01abc3e1d4166cb5fb566aad | |
parent | 5d373afb4650ca2ac77d0466bc34652d7fb82c7e (diff) |
automatic import of python-parameterized
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-parameterized.spec | 235 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 237 insertions, 0 deletions
@@ -0,0 +1 @@ +/parameterized-0.9.0.tar.gz diff --git a/python-parameterized.spec b/python-parameterized.spec new file mode 100644 index 0000000..f90d3fe --- /dev/null +++ b/python-parameterized.spec @@ -0,0 +1,235 @@ +%global _empty_manifest_terminate_build 0 +Name: python-parameterized +Version: 0.9.0 +Release: 1 +Summary: Parameterized testing with any Python test framework +License: FreeBSD +URL: https://github.com/wolever/parameterized +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ea/49/00c0c0cc24ff4266025a53e41336b79adaa5a4ebfad214f433d623f9865e/parameterized-0.9.0.tar.gz +BuildArch: noarch + +Requires: python3-jinja2 + +%description +Parameterized testing in Python sucks. +``parameterized`` fixes that. For everything. Parameterized testing for nose, +parameterized testing for py.test, parameterized testing for unittest. + # test_math.py + from nose.tools import assert_equal + from parameterized import parameterized, parameterized_class + import unittest + import math + @parameterized([ + (2, 2, 4), + (2, 3, 8), + (1, 9, 1), + (0, 9, 0), + ]) + def test_pow(base, exponent, expected): + assert_equal(math.pow(base, exponent), expected) + class TestMathUnitTest(unittest.TestCase): + @parameterized.expand([ + ("negative", -1.5, -2.0), + ("integer", 1, 1.0), + ("large fraction", 1.6, 1), + ]) + def test_floor(self, name, input, expected): + assert_equal(math.floor(input), expected) + @parameterized_class(('a', 'b', 'expected_sum', 'expected_product'), [ + (1, 2, 3, 2), + (5, 5, 10, 25), + ]) + class TestMathClass(unittest.TestCase): + def test_add(self): + assert_equal(self.a + self.b, self.expected_sum) + def test_multiply(self): + assert_equal(self.a * self.b, self.expected_product) + @parameterized_class([ + { "a": 3, "expected": 2 }, + { "b": 5, "expected": -4 }, + ]) + class TestMathClassDict(unittest.TestCase): + a = 1 + b = 1 + def test_subtract(self): + assert_equal(self.a - self.b, self.expected) +With nose (and nose2):: + $ nosetests -v test_math.py + test_floor_0_negative (test_math.TestMathUnitTest) ... ok + test_floor_1_integer (test_math.TestMathUnitTest) ... ok + test_floor_2_large_fraction (test_math.TestMathUnitTest) ... ok + test_math.test_pow(2, 2, 4, {}) ... ok + test_math.test_pow(2, 3, 8, {}) ... ok + test_math.test_pow(1, 9, 1, {}) ... ok + test_math.test_pow(0, 9, 0, {}) ... ok + test_add (test_math.TestMathClass_0) ... ok + test_multiply (test_math.TestMathClass_0) ... ok + test_add (test_math.TestMathClass_1) ... ok + test_multiply (test_math.TestMathClass_1) ... ok + +%package -n python3-parameterized +Summary: Parameterized testing with any Python test framework +Provides: python-parameterized +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-parameterized +Parameterized testing in Python sucks. +``parameterized`` fixes that. For everything. Parameterized testing for nose, +parameterized testing for py.test, parameterized testing for unittest. + # test_math.py + from nose.tools import assert_equal + from parameterized import parameterized, parameterized_class + import unittest + import math + @parameterized([ + (2, 2, 4), + (2, 3, 8), + (1, 9, 1), + (0, 9, 0), + ]) + def test_pow(base, exponent, expected): + assert_equal(math.pow(base, exponent), expected) + class TestMathUnitTest(unittest.TestCase): + @parameterized.expand([ + ("negative", -1.5, -2.0), + ("integer", 1, 1.0), + ("large fraction", 1.6, 1), + ]) + def test_floor(self, name, input, expected): + assert_equal(math.floor(input), expected) + @parameterized_class(('a', 'b', 'expected_sum', 'expected_product'), [ + (1, 2, 3, 2), + (5, 5, 10, 25), + ]) + class TestMathClass(unittest.TestCase): + def test_add(self): + assert_equal(self.a + self.b, self.expected_sum) + def test_multiply(self): + assert_equal(self.a * self.b, self.expected_product) + @parameterized_class([ + { "a": 3, "expected": 2 }, + { "b": 5, "expected": -4 }, + ]) + class TestMathClassDict(unittest.TestCase): + a = 1 + b = 1 + def test_subtract(self): + assert_equal(self.a - self.b, self.expected) +With nose (and nose2):: + $ nosetests -v test_math.py + test_floor_0_negative (test_math.TestMathUnitTest) ... ok + test_floor_1_integer (test_math.TestMathUnitTest) ... ok + test_floor_2_large_fraction (test_math.TestMathUnitTest) ... ok + test_math.test_pow(2, 2, 4, {}) ... ok + test_math.test_pow(2, 3, 8, {}) ... ok + test_math.test_pow(1, 9, 1, {}) ... ok + test_math.test_pow(0, 9, 0, {}) ... ok + test_add (test_math.TestMathClass_0) ... ok + test_multiply (test_math.TestMathClass_0) ... ok + test_add (test_math.TestMathClass_1) ... ok + test_multiply (test_math.TestMathClass_1) ... ok + +%package help +Summary: Development documents and examples for parameterized +Provides: python3-parameterized-doc +%description help +Parameterized testing in Python sucks. +``parameterized`` fixes that. For everything. Parameterized testing for nose, +parameterized testing for py.test, parameterized testing for unittest. + # test_math.py + from nose.tools import assert_equal + from parameterized import parameterized, parameterized_class + import unittest + import math + @parameterized([ + (2, 2, 4), + (2, 3, 8), + (1, 9, 1), + (0, 9, 0), + ]) + def test_pow(base, exponent, expected): + assert_equal(math.pow(base, exponent), expected) + class TestMathUnitTest(unittest.TestCase): + @parameterized.expand([ + ("negative", -1.5, -2.0), + ("integer", 1, 1.0), + ("large fraction", 1.6, 1), + ]) + def test_floor(self, name, input, expected): + assert_equal(math.floor(input), expected) + @parameterized_class(('a', 'b', 'expected_sum', 'expected_product'), [ + (1, 2, 3, 2), + (5, 5, 10, 25), + ]) + class TestMathClass(unittest.TestCase): + def test_add(self): + assert_equal(self.a + self.b, self.expected_sum) + def test_multiply(self): + assert_equal(self.a * self.b, self.expected_product) + @parameterized_class([ + { "a": 3, "expected": 2 }, + { "b": 5, "expected": -4 }, + ]) + class TestMathClassDict(unittest.TestCase): + a = 1 + b = 1 + def test_subtract(self): + assert_equal(self.a - self.b, self.expected) +With nose (and nose2):: + $ nosetests -v test_math.py + test_floor_0_negative (test_math.TestMathUnitTest) ... ok + test_floor_1_integer (test_math.TestMathUnitTest) ... ok + test_floor_2_large_fraction (test_math.TestMathUnitTest) ... ok + test_math.test_pow(2, 2, 4, {}) ... ok + test_math.test_pow(2, 3, 8, {}) ... ok + test_math.test_pow(1, 9, 1, {}) ... ok + test_math.test_pow(0, 9, 0, {}) ... ok + test_add (test_math.TestMathClass_0) ... ok + test_multiply (test_math.TestMathClass_0) ... ok + test_add (test_math.TestMathClass_1) ... ok + test_multiply (test_math.TestMathClass_1) ... ok + +%prep +%autosetup -n parameterized-0.9.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-parameterized -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.9.0-1 +- Package Spec generated @@ -0,0 +1 @@ +ed1bee2fb5d9044688d8503bdda9e6f3 parameterized-0.9.0.tar.gz |