Hello community, here is the log from the commit of package python-hamcrest for openSUSE:Factory checked in at 2017-06-04 01:56:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-hamcrest (Old) and /work/SRC/openSUSE:Factory/.python-hamcrest.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-hamcrest" Sun Jun 4 01:56:32 2017 rev:1 rq:496513 version:1.9.0 Changes: -------- New Changes file: --- /dev/null 2017-03-01 00:40:19.279048016 +0100 +++ /work/SRC/openSUSE:Factory/.python-hamcrest.new/python-hamcrest.changes 2017-06-04 01:56:32.708036391 +0200 @@ -0,0 +1,36 @@ +------------------------------------------------------------------- +Mon Mar 13 20:14:09 UTC 2017 - [email protected] + +- Updating spec to address common python gotchas: + * https://en.opensuse.org/openSUSE:Packaging_Python_Singlespec#Common_Gotchas + +------------------------------------------------------------------- +Fri Mar 10 18:13:47 UTC 2017 - [email protected] + +- using python_expand macro for fdupes + +------------------------------------------------------------------- +Fri Mar 10 17:13:40 UTC 2017 - [email protected] + +- adding fdupes. + +------------------------------------------------------------------- +Fri Mar 10 16:41:44 UTC 2017 - [email protected] + +- Changing to singlespec + +------------------------------------------------------------------- +Fri Feb 3 23:14:40 UTC 2017 - [email protected] + +- Changing name to be consistent with singlespec + +------------------------------------------------------------------- +Fri Feb 3 20:31:28 UTC 2017 - [email protected] + +- Enabling python3 build, updating to latest version + +------------------------------------------------------------------- +Wed Aug 6 03:22:22 UTC 2014 - [email protected] + +- Adding initial version of python-hamcrest + New: ---- 0001-Add-boolean-matchers.patch PyHamcrest-1.9.0.tar.gz _service python-hamcrest.changes python-hamcrest.spec ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-hamcrest.spec ++++++ # # spec file for package python-hamcrest # # Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-hamcrest Version: 1.9.0 Release: 0 Summary: Hamcrest framework for matcher objects License: BSD-3-Clause Group: Development/Languages/Python Url: https://github.com/hamcrest/PyHamcrest Source: http://pypi.python.org/packages/source/P/PyHamcrest/PyHamcrest-%{version}.tar.gz Patch0: 0001-Add-boolean-matchers.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module six} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-setuptools Requires: python-six BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch %python_subpackages %description PyHamcrest is a framework for writing matcher objects, allowing you to declaratively define "match" rules. %prep %setup -q -n PyHamcrest-%{version} %patch0 -p1 %build %python_build %install %python_install %fdupes %{buildroot}%{_prefix} %files %python_files %defattr(-,root,root,-) %doc CHANGES.txt LICENSE.txt README.rst %{python_sitelib}/PyHamcrest-%{version}-py*.egg-info/ %{python_sitelib}/hamcrest/ %changelog ++++++ 0001-Add-boolean-matchers.patch ++++++ >From 37a4d0dbeb9a92b959edfb9b1aceba4eaacf9f78 Mon Sep 17 00:00:00 2001 From: Alex Panov <[email protected]> Date: Sun, 15 May 2016 23:36:18 -0400 Subject: [PATCH] Add boolean matchers --- README.rst | 5 ++++ src/hamcrest/library/__init__.py | 3 ++ src/hamcrest/library/bool/__init__.py | 1 + src/hamcrest/library/bool/bool_comparison.py | 22 ++++++++++++++ tests/hamcrest_unit_test/bool/__init__.py | 0 .../bool/bool_comparison_test.py | 34 ++++++++++++++++++++++ 6 files changed, 65 insertions(+) create mode 100644 src/hamcrest/library/bool/__init__.py create mode 100644 src/hamcrest/library/bool/bool_comparison.py create mode 100644 tests/hamcrest_unit_test/bool/__init__.py create mode 100644 tests/hamcrest_unit_test/bool/bool_comparison_test.py diff --git a/README.rst b/README.rst index 8ef46bb..d2200f8 100644 --- a/README.rst +++ b/README.rst @@ -148,6 +148,11 @@ PyHamcrest comes with a library of useful matchers: * ``greater_than``, ``greater_than_or_equal_to``, ``less_than``, ``less_than_or_equal_to`` - match numeric ordering +* Boolean + + * ``is_true`` - verify the value is True + * ``is_false`` - verify the value is False + * Text * ``contains_string`` - match part of a string diff --git a/src/hamcrest/library/__init__.py b/src/hamcrest/library/__init__.py index a5a7963..55dfcda 100644 --- a/src/hamcrest/library/__init__.py +++ b/src/hamcrest/library/__init__.py @@ -7,6 +7,7 @@ from hamcrest.library.integration import * from hamcrest.library.number import * from hamcrest.library.object import * from hamcrest.library.text import * +from hamcrest.library.bool import * __author__ = "Jon Reid" __copyright__ = "Copyright 2011 hamcrest.org" @@ -41,4 +42,6 @@ __all__ = [ 'ends_with', 'starts_with', 'string_contains_in_order', + 'is_true', + 'is_false' ] diff --git a/src/hamcrest/library/bool/__init__.py b/src/hamcrest/library/bool/__init__.py new file mode 100644 index 0000000..7cf13a3 --- /dev/null +++ b/src/hamcrest/library/bool/__init__.py @@ -0,0 +1 @@ +from .bool_comparison import is_true, is_false diff --git a/src/hamcrest/library/bool/bool_comparison.py b/src/hamcrest/library/bool/bool_comparison.py new file mode 100644 index 0000000..af7e1b6 --- /dev/null +++ b/src/hamcrest/library/bool/bool_comparison.py @@ -0,0 +1,22 @@ +from hamcrest.core.base_matcher import BaseMatcher + + +class IsABool(BaseMatcher): + def __init__(self, boolean_value): + self.boolean_value = boolean_value + + def describe_to(self, description): + description.append_text(str(self.boolean_value)) + + def _matches(self, item): + if not isinstance(item, bool): + return False + return item == self.boolean_value + + +def is_true(): + return IsABool(True) + + +def is_false(): + return IsABool(False) diff --git a/tests/hamcrest_unit_test/bool/__init__.py b/tests/hamcrest_unit_test/bool/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/hamcrest_unit_test/bool/bool_comparison_test.py b/tests/hamcrest_unit_test/bool/bool_comparison_test.py new file mode 100644 index 0000000..e865365 --- /dev/null +++ b/tests/hamcrest_unit_test/bool/bool_comparison_test.py @@ -0,0 +1,34 @@ +from hamcrest import assert_that, equal_to +from hamcrest.core.string_description import StringDescription +from hamcrest.library.bool import is_false, is_true +from hamcrest_unit_test.matcher_test import MatcherTest + + +class BoolComparisonTest(MatcherTest): + def test_true_is_true(self): + self.assert_matches('Is True', is_true(), True) + + def test_false_is_not_true(self): + self.assert_does_not_match('False', is_true(), False) + + def test_false_is_false(self): + self.assert_matches('False', is_false(), False) + + def test_true_is_not_false(self): + self.assert_does_not_match('True', is_false(), True) + + def test_number_is_not_true(self): + self.assert_does_not_match('True', is_true(), 1) + + def test_number_is_not_false(self): + self.assert_does_not_match('False', is_false(), 1) + + def test_is_true_description(self): + description = StringDescription() + is_true().describe_to(description) + assert_that(str(description), equal_to('True')) + + def test_is_false_description(self): + description = StringDescription() + is_false().describe_to(description) + assert_that(str(description), equal_to('False')) -- 2.9.3 ++++++ _service ++++++ <services> <service name="download_files" mode="disabled"> <param name="changesgenerate">enable</param> </service> </services>
