Nilesh Patra pushed to branch master at Debian Med / python-multisplitby
Commits: 81335871 by Nilesh Patra at 2021-08-11T00:37:04+05:30 Add autopkgtests - - - - - c22bfd73 by Nilesh Patra at 2021-08-11T00:37:14+05:30 Bump debhelper compatibility level to 13 - - - - - fb624de9 by Nilesh Patra at 2021-08-11T00:37:45+05:30 Interim changelog entry - - - - - 4 changed files: - debian/changelog - debian/control - + debian/tests/control - + debian/tests/run-unit-test Changes: ===================================== debian/changelog ===================================== @@ -1,3 +1,11 @@ +python-multisplitby (0.0.1-3) UNRELEASED; urgency=medium + + * Team Upload. + * Add autopkgtests + * Bump debhelper compatibility level to 13 + + -- Nilesh Patra <[email protected]> Wed, 11 Aug 2021 00:37:26 +0530 + python-multisplitby (0.0.1-2) unstable; urgency=medium * Enhance short description (thanks to Scott Kitterman) ===================================== debian/control ===================================== @@ -4,7 +4,7 @@ Testsuite: autopkgtest-pkg-python Priority: optional Maintainer: Debian Med Packaging Team <[email protected]> Uploaders: Andreas Tille <[email protected]> -Build-Depends: debhelper-compat (= 12), +Build-Depends: debhelper-compat (= 13), dh-python, python3-all, python3-setuptools, ===================================== debian/tests/control ===================================== @@ -0,0 +1,3 @@ +Tests: run-unit-test +Depends: @ +Restrictions: allow-stderr ===================================== debian/tests/run-unit-test ===================================== @@ -0,0 +1,57 @@ +#!/bin/bash +set -e + +pkg=multisplitby +CUR_DIR=`pwd` + +if [ "${AUTOPKGTEST_TMP}" = "" ] ; then + AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX) + trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM +fi + +cd "${AUTOPKGTEST_TMP}" + +cat >test_sample.py <<HERE +from multisplitby import multi_split_by +import unittest + +class TestBasicFunctionality(unittest.TestCase): + + def test_one_predicate(self): + values = range(4) + predicates = [lambda x: 2 < x] + self.assertEqual(list(map(list, multi_split_by(values, predicates))), + [[0, 1, 2], [3]]) + + def test_many_predicates(self): + values = range(9) + predicates = [lambda x: 2 < x, lambda x: 4 < x, lambda x: 7 < x] + self.assertEqual(list(map(list, multi_split_by(values, predicates))), + [[0, 1, 2], [3, 4], [5, 6, 7], [8]]) + + def test_noinfo(self): + values = [] + predicates = [lambda x: 2 < x, lambda x: 4 < x, lambda x: 7 < x] + self.assertEqual(list(map(list, multi_split_by(values, predicates))), + [[], [], [], []]) + + def test_no_predicates(self): + values = range(4) + predicates = [] + self.assertEqual(list(map(list, multi_split_by(values, predicates))), + [[0, 1, 2, 3]]) + +if __name__ == '__main__': + unittest.main() +HERE + +echo "Running sample test" +python3 -m unittest -v +rm -f ./test_sample.py +echo "=============== PASS =====================" + + +cp -a ${CUR_DIR}/tests "${AUTOPKGTEST_TMP}" +echo "Run upstream test" +python3 -m unittest -v +echo "=============== PASS =====================" View it on GitLab: https://salsa.debian.org/med-team/python-multisplitby/-/compare/5904ad6b569f271330d9d77922030fd4c07566b9...fb624de9c23b5bc26fb375ccfcb2ef244d8f05da -- View it on GitLab: https://salsa.debian.org/med-team/python-multisplitby/-/compare/5904ad6b569f271330d9d77922030fd4c07566b9...fb624de9c23b5bc26fb375ccfcb2ef244d8f05da You're receiving this email because of your account on salsa.debian.org.
_______________________________________________ debian-med-commit mailing list [email protected] https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-med-commit
