diff --git a/0001-Remove-sorting-of-dictionaries-in-pretty.printer.-33.patch b/0001-Remove-sorting-of-dictionaries-in-pretty.printer.-33.patch new file mode 100644 index 0000000000000000000000000000000000000000..2e6895a4c777237bc5868c4ae8ad485b293ffa3e --- /dev/null +++ b/0001-Remove-sorting-of-dictionaries-in-pretty.printer.-33.patch @@ -0,0 +1,48 @@ +From 0f5c68ec8ada9d5e8841cd692a2bb8e1f5c8e6b5 Mon Sep 17 00:00:00 2001 +From: "J.F.P. (Richard) Scholtens" +Date: Fri, 10 Jun 2022 15:36:57 +0200 +Subject: [PATCH] Remove sorting of dictionaries in pretty.printer. #3370 + +Order of dictionaries is now enforced in Python 3.7 and higher. This means that the original order of dictionaries matters for falsifying examples. +--- + hypothesis-python/src/hypothesis/vendor/pretty.py | 11 +---------- + hypothesis-python/tests/cover/test_pretty.py | 1 + + 2 files changed, 2 insertions(+), 10 deletions(-) + +diff --git a/hypothesis-python/src/hypothesis/vendor/pretty.py b/hypothesis-python/src/hypothesis/vendor/pretty.py +index 8816f5ca7..2f52ecf64 100644 +--- a/hypothesis-python/src/hypothesis/vendor/pretty.py ++++ b/hypothesis-python/src/hypothesis/vendor/pretty.py +@@ -603,16 +603,7 @@ def _dict_pprinter_factory(start, end, basetype=None): + if cycle: + return p.text("{...}") + p.begin_group(1, start) +- keys = obj.keys() +- # if dict isn't large enough to be truncated, sort keys before +- # displaying +- if not (p.max_seq_length and len(obj) >= p.max_seq_length): +- try: +- keys = sorted(keys) +- except Exception: +- # Sometimes the keys don't sort. +- pass +- for idx, key in p._enumerate(keys): ++ for idx, key in p._enumerate(obj): + if idx: + p.text(",") + p.breakable() +diff --git a/hypothesis-python/tests/cover/test_pretty.py b/hypothesis-python/tests/cover/test_pretty.py +index 22db2292b..86359362f 100644 +--- a/hypothesis-python/tests/cover/test_pretty.py ++++ b/hypothesis-python/tests/cover/test_pretty.py +@@ -134,6 +134,7 @@ def test_list(): + def test_dict(): + assert pretty.pretty({}) == "{}" + assert pretty.pretty({1: 1}) == "{1: 1}" ++ assert pretty.pretty({1: 1, 0: 0}) == "{1: 1, 0: 0}" + + + def test_tuple(): +-- +2.42.0.windows.2 + diff --git a/python-hypothesis.spec b/python-hypothesis.spec index 50472fd654c0a363e6aa62ca504f6d5e3cba4fb8..e911704fa871b0c18f794d68d805ec573db4e1cb 100644 --- a/python-hypothesis.spec +++ b/python-hypothesis.spec @@ -1,7 +1,7 @@ %{?python_enable_dependency_generator} Name: python-hypothesis Version: 6.47.0 -Release: 1 +Release: 2 Summary: based testing for python code License: MPLv2.0 URL: https://github.com/HypothesisWorks/hypothesis-python @@ -9,6 +9,8 @@ Source0: https://github.com/HypothesisWorks/hypothesis/archive/hypothesis BuildRequires: python-sphinx BuildArch: noarch +Patch0001: 0001-Remove-sorting-of-dictionaries-in-pretty.printer.-33.patch + %description This package provides a library called hypothesis for testing Python code, which has more examples and is based on the Haskell library, Quickcheck, @@ -55,6 +57,9 @@ sed -i -e '/sphinx.ext.intersphinx/d' docs/conf.py %{python3_sitelib}/hypothesis/ %changelog +* Mon Nov 13 2023 liubo - 6.47.0-2 +- Remove sorting of dictionaries in pretty.printer. + * Thu Oct 27 2022 Ge Wang - 6.47.0-1 - Upgrade to 6.47.0