Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-hypothesmith for
openSUSE:Factory checked in at 2021-04-01 14:15:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-hypothesmith (Old)
and /work/SRC/openSUSE:Factory/.python-hypothesmith.new.2401 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-hypothesmith"
Thu Apr 1 14:15:50 2021 rev:4 rq:880624 version:0.1.8
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-hypothesmith/python-hypothesmith.changes
2020-11-17 21:21:16.205084514 +0100
+++
/work/SRC/openSUSE:Factory/.python-hypothesmith.new.2401/python-hypothesmith.changes
2021-04-01 14:15:51.739853099 +0200
@@ -1,0 +2,12 @@
+Sun Mar 21 20:41:41 UTC 2021 - Ben Greiner <[email protected]>
+
+- Update to v0.1.8
+ * Now compatible with Hypothesis 5.46 and later
+ * Increased diversity of examples generated by from_node()
+- Release v0.1.7
+ * Adds a workaround for BPO-42218
+ * Bumped Hypothesis requirement to version 5.41 or later
+ (better internal error messages)
+ * Added MANIFEST.in so the sdist includes license, tests, etc.
+
+-------------------------------------------------------------------
Old:
----
hypothesmith-0.1.6.tar.gz
hypothesmith-gh-0.1.6.tar.gz
New:
----
hypothesmith-0.1.8.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-hypothesmith.spec ++++++
--- /var/tmp/diff_new_pack.kHkgrj/_old 2021-04-01 14:15:52.167853841 +0200
+++ /var/tmp/diff_new_pack.kHkgrj/_new 2021-04-01 14:15:52.171853847 +0200
@@ -1,7 +1,7 @@
#
-# spec file for package python-hypothesmith
+# spec file for package python-hypothesmith-test
#
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,9 +18,6 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
-# no release tags in repository, but we need LICENSE and tests not
-# packaged in PyPI source https://github.com/Zac-HD/hypothesmith/issues/5
-%define commithash 40947c2e590f06ea5f3b88c6e75d8a98e9443c63
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
@@ -30,24 +27,23 @@
%bcond_with test
%endif
Name: python-hypothesmith%{psuffix}
-Version: 0.1.6
+Version: 0.1.8
Release: 0
Summary: Hypothesis strategies for generating Python programs,
something like CSmith
License: MPL-2.0
URL: https://github.com/Zac-HD/hypothesmith
Source:
https://files.pythonhosted.org/packages/source/h/hypothesmith/hypothesmith-%{version}.tar.gz
-Source1:
https://github.com/Zac-HD/hypothesmith/archive/%{commithash}.tar.gz#/hypothesmith-gh-%{version}.tar.gz
BuildRequires: %{python_module base >= 3.6}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-base >= 3.6
-Requires: python-hypothesis >= 5.23.7
+Requires: python-hypothesis >= 5.46
Requires: python-lark-parser >= 0.7.2
Requires: python-libcst >= 0.3.8
%if %{with test}
BuildRequires: %{python_module black}
-BuildRequires: %{python_module hypothesis >= 5.23.7}
+BuildRequires: %{python_module hypothesis >= 5.46}
BuildRequires: %{python_module lark-parser >= 0.7.2}
BuildRequires: %{python_module libcst >= 0.3.8}
BuildRequires: %{python_module parso}
@@ -61,8 +57,9 @@
Hypothesis strategies for generating Python programs, something like CSmith.
%prep
-%setup -q -n hypothesmith-%{version} -b 1
-cp -r ../hypothesmith-%{commithash}/{LICENSE,CHANGELOG.md,tests} .
+%setup -q -n hypothesmith-%{version}
+# remove pytest coverage opts
+rm tox.ini
%build
%if !%{with test}
++++++ hypothesmith-0.1.6.tar.gz -> hypothesmith-0.1.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/CHANGELOG.md
new/hypothesmith-0.1.8/CHANGELOG.md
--- old/hypothesmith-0.1.6/CHANGELOG.md 1970-01-01 01:00:00.000000000 +0100
+++ new/hypothesmith-0.1.8/CHANGELOG.md 2021-01-10 13:36:24.000000000 +0100
@@ -0,0 +1,68 @@
+# Changelog
+
+### 0.1.8 - 2021-01-10
+- Now compatible with Hypothesis 5.46 and later
+- Increased diversity of examples generated by `from_node()`
+
+### 0.1.7 - 2020-11-15
+- Adds a workaround for [BPO-42218](https://bugs.python.org/issue42218)
+- Bumped Hypothesis requirement to version 5.41 or later (better internal
error messages)
+- Added `MANIFEST.in` so the sdist includes license, tests, etc.
+
+### 0.1.6 - 2020-11-01
+- Improved error messages from internal compiler errors *again*
+ ([BPO-42218](https://bugs.python.org/issue42218) will be fixed in Python
3.9.1)
+- Bumped Hypothesis requirement to version 5.39 or later
+
+### 0.1.5 - 2020-10-12
+- Emit additional debug info when Python fails to compile a string
+
+### 0.1.4 - 2020-08-16
+- Improve handling of identifiers
+- Fix internal error in `from_grammar("single_input")`
+
+### 0.1.3 - 2020-07-30
+- Update to latest versions of LibCST and Hypothesis, for Python 3.9 support
+
+### 0.1.2 - 2020-05-17
+- Emit *more* debug info to diagnose a `compile()` issue in CPython nightly
+
+### 0.1.1 - 2020-05-17
+- Emit some debug info to help diagnose a possible upstream bug in CPython
nightly
+
+### 0.1.0 - 2020-04-24
+- Added `auto_target=True` argument to the `from_node()` strategy.
+- Improved `from_node()` generation of comments and trailing whitespace.
+
+### 0.0.8 - 2020-04-23
+- Added a `from_node()` strategy which uses
[`LibCST`](https://pypi.org/project/libcst/)
+ to generate source code. This is a proof-of-concept rather than a robust
tool,
+ but IMO it's a pretty cool concept.
+
+### 0.0.7 - 2020-04-19
+- The `from_grammar()` strategy now takes an `auto_target=True` argument, to
+drive generated examples towards (relatively) larger and more complex programs.
+
+### 0.0.6 - 2020-04-08
+- support for non-ASCII identifiers
+
+### 0.0.5 - 2019-11-27
+- Updated project metadata and started testing on Python 3.8
+
+### 0.0.4 - 2019-09-10
+- Depends on more recent Hypothesis version, with upstreamed grammar
generation.
+- Improved filtering rejects fewer valid examples, finding another bug in
Black.
+
+### 0.0.3 - 2019-08-08
+Checks validity at statement level, which makes filtering much more efficient.
+Improved testing, input validation, and code comments.
+
+### 0.0.2 - 2019-08-07
+Improved filtering and fixing of source code generated from the grammar.
+This version found a novel bug: `"pass #\\r#\\n"` is accepted by the
+built-in `compile()` and `exec()` functions, but not by `black` or `lib2to3`.
+
+### 0.0.1 - 2019-08-06
+Initial release. This is a minimal proof of concept, generating from the
+grammar and rejecting it if we get errors from `black` or `tokenize`.
+Cool, but while promising not very useful at this stage.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/LICENSE
new/hypothesmith-0.1.8/LICENSE
--- old/hypothesmith-0.1.6/LICENSE 1970-01-01 01:00:00.000000000 +0100
+++ new/hypothesmith-0.1.8/LICENSE 2021-01-10 13:36:24.000000000 +0100
@@ -0,0 +1,373 @@
+Mozilla Public License Version 2.0
+==================================
+
+1. Definitions
+--------------
+
+1.1. "Contributor"
+ means each individual or legal entity that creates, contributes to
+ the creation of, or owns Covered Software.
+
+1.2. "Contributor Version"
+ means the combination of the Contributions of others (if any) used
+ by a Contributor and that particular Contributor's Contribution.
+
+1.3. "Contribution"
+ means Covered Software of a particular Contributor.
+
+1.4. "Covered Software"
+ means Source Code Form to which the initial Contributor has attached
+ the notice in Exhibit A, the Executable Form of such Source Code
+ Form, and Modifications of such Source Code Form, in each case
+ including portions thereof.
+
+1.5. "Incompatible With Secondary Licenses"
+ means
+
+ (a) that the initial Contributor has attached the notice described
+ in Exhibit B to the Covered Software; or
+
+ (b) that the Covered Software was made available under the terms of
+ version 1.1 or earlier of the License, but not also under the
+ terms of a Secondary License.
+
+1.6. "Executable Form"
+ means any form of the work other than Source Code Form.
+
+1.7. "Larger Work"
+ means a work that combines Covered Software with other material, in
+ a separate file or files, that is not Covered Software.
+
+1.8. "License"
+ means this document.
+
+1.9. "Licensable"
+ means having the right to grant, to the maximum extent possible,
+ whether at the time of the initial grant or subsequently, any and
+ all of the rights conveyed by this License.
+
+1.10. "Modifications"
+ means any of the following:
+
+ (a) any file in Source Code Form that results from an addition to,
+ deletion from, or modification of the contents of Covered
+ Software; or
+
+ (b) any new file in Source Code Form that contains any Covered
+ Software.
+
+1.11. "Patent Claims" of a Contributor
+ means any patent claim(s), including without limitation, method,
+ process, and apparatus claims, in any patent Licensable by such
+ Contributor that would be infringed, but for the grant of the
+ License, by the making, using, selling, offering for sale, having
+ made, import, or transfer of either its Contributions or its
+ Contributor Version.
+
+1.12. "Secondary License"
+ means either the GNU General Public License, Version 2.0, the GNU
+ Lesser General Public License, Version 2.1, the GNU Affero General
+ Public License, Version 3.0, or any later versions of those
+ licenses.
+
+1.13. "Source Code Form"
+ means the form of the work preferred for making modifications.
+
+1.14. "You" (or "Your")
+ means an individual or a legal entity exercising rights under this
+ License. For legal entities, "You" includes any entity that
+ controls, is controlled by, or is under common control with You. For
+ purposes of this definition, "control" means (a) the power, direct
+ or indirect, to cause the direction or management of such entity,
+ whether by contract or otherwise, or (b) ownership of more than
+ fifty percent (50%) of the outstanding shares or beneficial
+ ownership of such entity.
+
+2. License Grants and Conditions
+--------------------------------
+
+2.1. Grants
+
+Each Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than patent or trademark)
+ Licensable by such Contributor to use, reproduce, make available,
+ modify, display, perform, distribute, and otherwise exploit its
+ Contributions, either on an unmodified basis, with Modifications, or
+ as part of a Larger Work; and
+
+(b) under Patent Claims of such Contributor to make, use, sell, offer
+ for sale, have made, import, and otherwise transfer either its
+ Contributions or its Contributor Version.
+
+2.2. Effective Date
+
+The licenses granted in Section 2.1 with respect to any Contribution
+become effective for each Contribution on the date the Contributor first
+distributes such Contribution.
+
+2.3. Limitations on Grant Scope
+
+The licenses granted in this Section 2 are the only rights granted under
+this License. No additional rights or licenses will be implied from the
+distribution or licensing of Covered Software under this License.
+Notwithstanding Section 2.1(b) above, no patent license is granted by a
+Contributor:
+
+(a) for any code that a Contributor has removed from Covered Software;
+ or
+
+(b) for infringements caused by: (i) Your and any other third party's
+ modifications of Covered Software, or (ii) the combination of its
+ Contributions with other software (except as part of its Contributor
+ Version); or
+
+(c) under Patent Claims infringed by Covered Software in the absence of
+ its Contributions.
+
+This License does not grant any rights in the trademarks, service marks,
+or logos of any Contributor (except as may be necessary to comply with
+the notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+
+No Contributor makes additional grants as a result of Your choice to
+distribute the Covered Software under a subsequent version of this
+License (see Section 10.2) or under the terms of a Secondary License (if
+permitted under the terms of Section 3.3).
+
+2.5. Representation
+
+Each Contributor represents that the Contributor believes its
+Contributions are its original creation(s) or it has sufficient rights
+to grant the rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
+
+This License is not intended to limit any rights You have under
+applicable copyright doctrines of fair use, fair dealing, or other
+equivalents.
+
+2.7. Conditions
+
+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+in Section 2.1.
+
+3. Responsibilities
+-------------------
+
+3.1. Distribution of Source Form
+
+All distribution of Covered Software in Source Code Form, including any
+Modifications that You create or to which You contribute, must be under
+the terms of this License. You must inform recipients that the Source
+Code Form of the Covered Software is governed by the terms of this
+License, and how they can obtain a copy of this License. You may not
+attempt to alter or restrict the recipients' rights in the Source Code
+Form.
+
+3.2. Distribution of Executable Form
+
+If You distribute Covered Software in Executable Form then:
+
+(a) such Covered Software must also be made available in Source Code
+ Form, as described in Section 3.1, and You must inform recipients of
+ the Executable Form how they can obtain a copy of such Source Code
+ Form by reasonable means in a timely manner, at a charge no more
+ than the cost of distribution to the recipient; and
+
+(b) You may distribute such Executable Form under the terms of this
+ License, or sublicense it under different terms, provided that the
+ license for the Executable Form does not attempt to limit or alter
+ the recipients' rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
+
+You may create and distribute a Larger Work under terms of Your choice,
+provided that You also comply with the requirements of this License for
+the Covered Software. If the Larger Work is a combination of Covered
+Software with a work governed by one or more Secondary Licenses, and the
+Covered Software is not Incompatible With Secondary Licenses, this
+License permits You to additionally distribute such Covered Software
+under the terms of such Secondary License(s), so that the recipient of
+the Larger Work may, at their option, further distribute the Covered
+Software under the terms of either this License or such Secondary
+License(s).
+
+3.4. Notices
+
+You may not remove or alter the substance of any license notices
+(including copyright notices, patent notices, disclaimers of warranty,
+or limitations of liability) contained within the Source Code Form of
+the Covered Software, except that You may alter any license notices to
+the extent required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
+
+You may choose to offer, and to charge a fee for, warranty, support,
+indemnity or liability obligations to one or more recipients of Covered
+Software. However, You may do so only on Your own behalf, and not on
+behalf of any Contributor. You must make it absolutely clear that any
+such warranty, support, indemnity, or liability obligation is offered by
+You alone, and You hereby agree to indemnify every Contributor for any
+liability incurred by such Contributor as a result of warranty, support,
+indemnity or liability terms You offer. You may include additional
+disclaimers of warranty and limitations of liability specific to any
+jurisdiction.
+
+4. Inability to Comply Due to Statute or Regulation
+---------------------------------------------------
+
+If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Software due to
+statute, judicial order, or regulation then You must: (a) comply with
+the terms of this License to the maximum extent possible; and (b)
+describe the limitations and the code they affect. Such description must
+be placed in a text file included with all distributions of the Covered
+Software under this License. Except to the extent prohibited by statute
+or regulation, such description must be sufficiently detailed for a
+recipient of ordinary skill to be able to understand it.
+
+5. Termination
+--------------
+
+5.1. The rights granted under this License will terminate automatically
+if You fail to comply with any of its terms. However, if You become
+compliant, then the rights granted under this License from a particular
+Contributor are reinstated (a) provisionally, unless and until such
+Contributor explicitly and finally terminates Your grants, and (b) on an
+ongoing basis, if such Contributor fails to notify You of the
+non-compliance by some reasonable means prior to 60 days after You have
+come back into compliance. Moreover, Your grants from a particular
+Contributor are reinstated on an ongoing basis if such Contributor
+notifies You of the non-compliance by some reasonable means, this is the
+first time You have received notice of non-compliance with this License
+from such Contributor, and You become compliant prior to 30 days after
+Your receipt of the notice.
+
+5.2. If You initiate litigation against any entity by asserting a patent
+infringement claim (excluding declaratory judgment actions,
+counter-claims, and cross-claims) alleging that a Contributor Version
+directly or indirectly infringes any patent, then the rights granted to
+You by any and all Contributors for the Covered Software under Section
+2.1 of this License shall terminate.
+
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+end user license agreements (excluding distributors and resellers) which
+have been validly granted by You or Your distributors under this License
+prior to termination shall survive termination.
+
+************************************************************************
+* *
+* 6. Disclaimer of Warranty *
+* ------------------------- *
+* *
+* Covered Software is provided under this License on an "as is" *
+* basis, without warranty of any kind, either expressed, implied, or *
+* statutory, including, without limitation, warranties that the *
+* Covered Software is free of defects, merchantable, fit for a *
+* particular purpose or non-infringing. The entire risk as to the *
+* quality and performance of the Covered Software is with You. *
+* Should any Covered Software prove defective in any respect, You *
+* (not any Contributor) assume the cost of any necessary servicing, *
+* repair, or correction. This disclaimer of warranty constitutes an *
+* essential part of this License. No use of any Covered Software is *
+* authorized under this License except under this disclaimer. *
+* *
+************************************************************************
+
+************************************************************************
+* *
+* 7. Limitation of Liability *
+* -------------------------- *
+* *
+* Under no circumstances and under no legal theory, whether tort *
+* (including negligence), contract, or otherwise, shall any *
+* Contributor, or anyone who distributes Covered Software as *
+* permitted above, be liable to You for any direct, indirect, *
+* special, incidental, or consequential damages of any character *
+* including, without limitation, damages for lost profits, loss of *
+* goodwill, work stoppage, computer failure or malfunction, or any *
+* and all other commercial damages or losses, even if such party *
+* shall have been informed of the possibility of such damages. This *
+* limitation of liability shall not apply to liability for death or *
+* personal injury resulting from such party's negligence to the *
+* extent applicable law prohibits such limitation. Some *
+* jurisdictions do not allow the exclusion or limitation of *
+* incidental or consequential damages, so this exclusion and *
+* limitation may not apply to You. *
+* *
+************************************************************************
+
+8. Litigation
+-------------
+
+Any litigation relating to this License may be brought only in the
+courts of a jurisdiction where the defendant maintains its principal
+place of business and such litigation shall be governed by laws of that
+jurisdiction, without reference to its conflict-of-law provisions.
+Nothing in this Section shall prevent a party's ability to bring
+cross-claims or counter-claims.
+
+9. Miscellaneous
+----------------
+
+This License represents the complete agreement concerning the subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent
+necessary to make it enforceable. Any law or regulation which provides
+that the language of a contract shall be construed against the drafter
+shall not be used to construe this License against a Contributor.
+
+10. Versions of the License
+---------------------------
+
+10.1. New Versions
+
+Mozilla Foundation is the license steward. Except as provided in Section
+10.3, no one other than the license steward has the right to modify or
+publish new versions of this License. Each version will be given a
+distinguishing version number.
+
+10.2. Effect of New Versions
+
+You may distribute the Covered Software under the terms of the version
+of the License under which You originally received the Covered Software,
+or under the terms of any subsequent version published by the license
+steward.
+
+10.3. Modified Versions
+
+If you create software not governed by this License, and you want to
+create a new license for such software, you may create and use a
+modified version of this License if you rename the license and remove
+any references to the name of the license steward (except to note that
+such modified license differs from this License).
+
+10.4. Distributing Source Code Form that is Incompatible With Secondary
+Licenses
+
+If You choose to distribute Source Code Form that is Incompatible With
+Secondary Licenses under the terms of this version of the License, the
+notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+-------------------------------------------
+
+ This Source Code Form is subject to the terms of the Mozilla Public
+ License, v. 2.0. If a copy of the MPL was not distributed with this
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+If it is not possible or desirable to put the notice in a particular
+file, then You may include the notice in a location (such as a LICENSE
+file in a relevant directory) where a recipient would be likely to look
+for such a notice.
+
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - "Incompatible With Secondary Licenses" Notice
+---------------------------------------------------------
+
+ This Source Code Form is "Incompatible With Secondary Licenses", as
+ defined by the Mozilla Public License, v. 2.0.
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/MANIFEST.in
new/hypothesmith-0.1.8/MANIFEST.in
--- old/hypothesmith-0.1.6/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100
+++ new/hypothesmith-0.1.8/MANIFEST.in 2021-01-10 13:36:24.000000000 +0100
@@ -0,0 +1,5 @@
+include *.md
+include LICENSE
+include tox.ini
+recursive-include deps *.in *.md *.txt
+recursive-include tests *.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/PKG-INFO
new/hypothesmith-0.1.8/PKG-INFO
--- old/hypothesmith-0.1.6/PKG-INFO 2020-11-01 14:21:03.061625000 +0100
+++ new/hypothesmith-0.1.8/PKG-INFO 2021-01-10 13:36:42.288650000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: hypothesmith
-Version: 0.1.6
+Version: 0.1.8
Summary: Hypothesis strategies for generating Python programs, something like
CSmith
Home-page: https://github.com/Zac-HD/hypothesmith
Author: Zac Hatfield-Dodds
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/deps/README.md
new/hypothesmith-0.1.8/deps/README.md
--- old/hypothesmith-0.1.6/deps/README.md 1970-01-01 01:00:00.000000000
+0100
+++ new/hypothesmith-0.1.8/deps/README.md 2021-01-10 13:36:24.000000000
+0100
@@ -0,0 +1,17 @@
+# Pinning dependencies
+
+Hypothesmith pins *all* our dependencies for testing, and disables installation
+of any unlisted dependencies to make sure the set of pins is complete.
+
+How does this work?
+
+1. `setup.py` lists all our top-level dependencies for the library,
+ and *also* lists the development and test-time dependencies.
+2. `pip-compile` calculates all the transitive dependencies we need,
+ with exact version pins. We use `tox -e deps` to make this more
+ convenient, and don't bother pinning `pip-tools` as it's always
+ run manually (never in CI).
+3. `tox` then installs from the files full of pinned versions here!
+
+That's it - a simple implementation but it stabilises the whole dependency
+chain and really improves visibility :-)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/deps/check.in
new/hypothesmith-0.1.8/deps/check.in
--- old/hypothesmith-0.1.6/deps/check.in 1970-01-01 01:00:00.000000000
+0100
+++ new/hypothesmith-0.1.8/deps/check.in 2021-01-10 13:36:24.000000000
+0100
@@ -0,0 +1,8 @@
+# Top-level dependencies for `tox -e check`
+flake8
+flake8-bandit
+flake8-bugbear
+flake8-comprehensions
+flake8-docstrings
+mypy
+shed
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/deps/check.txt
new/hypothesmith-0.1.8/deps/check.txt
--- old/hypothesmith-0.1.6/deps/check.txt 1970-01-01 01:00:00.000000000
+0100
+++ new/hypothesmith-0.1.8/deps/check.txt 2021-01-10 13:36:24.000000000
+0100
@@ -0,0 +1,120 @@
+#
+# This file is autogenerated by pip-compile
+# To update, run:
+#
+# pip-compile --output-file=deps/check.txt deps/check.in
+#
+appdirs==1.4.4
+ # via black
+attrs==20.3.0
+ # via flake8-bugbear
+autoflake==1.4
+ # via shed
+bandit==1.7.0
+ # via flake8-bandit
+black==20.8b1
+ # via shed
+click==7.1.2
+ # via
+ # black
+ # pybetter
+ # pyemojify
+colorama==0.4.4
+ # via bandit
+flake8-bandit==2.1.2
+ # via -r deps/check.in
+flake8-bugbear==20.11.1
+ # via -r deps/check.in
+flake8-comprehensions==3.3.1
+ # via -r deps/check.in
+flake8-docstrings==1.5.0
+ # via -r deps/check.in
+flake8-polyfill==1.0.2
+ # via flake8-bandit
+flake8==3.8.4
+ # via
+ # -r deps/check.in
+ # flake8-bandit
+ # flake8-bugbear
+ # flake8-comprehensions
+ # flake8-docstrings
+ # flake8-polyfill
+gitdb==4.0.5
+ # via gitpython
+gitpython==3.1.12
+ # via bandit
+importlib-metadata==3.3.0
+ # via
+ # flake8
+ # flake8-comprehensions
+ # stevedore
+isort==5.7.0
+ # via shed
+libcst==0.3.16
+ # via pybetter
+mccabe==0.6.1
+ # via flake8
+mypy-extensions==0.4.3
+ # via
+ # black
+ # mypy
+ # typing-inspect
+mypy==0.790
+ # via -r deps/check.in
+pathspec==0.8.1
+ # via black
+pbr==5.5.1
+ # via stevedore
+pybetter==0.3.5
+ # via shed
+pycodestyle==2.6.0
+ # via
+ # flake8
+ # flake8-bandit
+pydocstyle==5.1.1
+ # via flake8-docstrings
+pyemojify==0.2.0
+ # via pybetter
+pyflakes==2.2.0
+ # via
+ # autoflake
+ # flake8
+pygments==2.7.3
+ # via pybetter
+pyupgrade==2.7.4
+ # via shed
+pyyaml==5.3.1
+ # via
+ # bandit
+ # libcst
+regex==2020.11.13
+ # via black
+shed==0.2.5
+ # via -r deps/check.in
+six==1.15.0
+ # via bandit
+smmap==3.0.4
+ # via gitdb
+snowballstemmer==2.0.0
+ # via pydocstyle
+stevedore==3.3.0
+ # via bandit
+tokenize-rt==4.0.0
+ # via pyupgrade
+toml==0.10.2
+ # via black
+typed-ast==1.4.2
+ # via
+ # black
+ # mypy
+typing-extensions==3.7.4.3
+ # via
+ # black
+ # importlib-metadata
+ # libcst
+ # mypy
+ # typing-inspect
+typing-inspect==0.6.0
+ # via libcst
+zipp==3.4.0
+ # via importlib-metadata
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/deps/test.in
new/hypothesmith-0.1.8/deps/test.in
--- old/hypothesmith-0.1.6/deps/test.in 1970-01-01 01:00:00.000000000 +0100
+++ new/hypothesmith-0.1.8/deps/test.in 2021-01-10 13:36:24.000000000 +0100
@@ -0,0 +1,6 @@
+# Top-level dependencies for `tox -e test`
+black
+parso
+pytest
+pytest-cov
+pytest-xdist
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/deps/test.txt
new/hypothesmith-0.1.8/deps/test.txt
--- old/hypothesmith-0.1.6/deps/test.txt 1970-01-01 01:00:00.000000000
+0100
+++ new/hypothesmith-0.1.8/deps/test.txt 2021-01-10 13:36:24.000000000
+0100
@@ -0,0 +1,90 @@
+#
+# This file is autogenerated by pip-compile
+# To update, run:
+#
+# pip-compile --output-file=deps/test.txt deps/test.in setup.py
+#
+apipkg==1.5
+ # via execnet
+appdirs==1.4.4
+ # via black
+atomicwrites==1.4.0
+ # via pytest
+attrs==20.3.0
+ # via
+ # hypothesis
+ # pytest
+black==20.8b1
+ # via -r deps/test.in
+click==7.1.2
+ # via black
+colorama==0.4.4
+ # via pytest
+coverage==5.3.1
+ # via pytest-cov
+execnet==1.7.1
+ # via pytest-xdist
+hypothesis==6.0.0
+ # via hypothesmith (setup.py)
+importlib-metadata==3.3.0
+ # via
+ # pluggy
+ # pytest
+iniconfig==1.1.1
+ # via pytest
+lark-parser==0.11.1
+ # via hypothesmith (setup.py)
+libcst==0.3.16
+ # via hypothesmith (setup.py)
+mypy-extensions==0.4.3
+ # via
+ # black
+ # typing-inspect
+packaging==20.8
+ # via pytest
+parso==0.8.1
+ # via -r deps/test.in
+pathspec==0.8.1
+ # via black
+pluggy==0.13.1
+ # via pytest
+py==1.10.0
+ # via
+ # pytest
+ # pytest-forked
+pyparsing==2.4.7
+ # via packaging
+pytest-cov==2.10.1
+ # via -r deps/test.in
+pytest-forked==1.3.0
+ # via pytest-xdist
+pytest-xdist==2.2.0
+ # via -r deps/test.in
+pytest==6.2.1
+ # via
+ # -r deps/test.in
+ # pytest-cov
+ # pytest-forked
+ # pytest-xdist
+pyyaml==5.3.1
+ # via libcst
+regex==2020.11.13
+ # via black
+sortedcontainers==2.3.0
+ # via hypothesis
+toml==0.10.2
+ # via
+ # black
+ # pytest
+typed-ast==1.4.2
+ # via black
+typing-extensions==3.7.4.3
+ # via
+ # black
+ # importlib-metadata
+ # libcst
+ # typing-inspect
+typing-inspect==0.6.0
+ # via libcst
+zipp==3.4.0
+ # via importlib-metadata
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/setup.py
new/hypothesmith-0.1.8/setup.py
--- old/hypothesmith-0.1.6/setup.py 2020-11-01 14:20:53.000000000 +0100
+++ new/hypothesmith-0.1.8/setup.py 2021-01-10 13:36:24.000000000 +0100
@@ -32,7 +32,7 @@
license="MPL 2.0",
description="Hypothesis strategies for generating Python programs,
something like CSmith",
zip_safe=False,
- install_requires=["hypothesis>=5.39.0", "lark-parser>=0.7.2",
"libcst>=0.3.8"],
+ install_requires=["hypothesis>=5.41.0", "lark-parser>=0.7.2",
"libcst>=0.3.8"],
python_requires=">=3.6",
classifiers=[
"Development Status :: 4 - Beta",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/src/hypothesmith/__init__.py
new/hypothesmith-0.1.8/src/hypothesmith/__init__.py
--- old/hypothesmith-0.1.6/src/hypothesmith/__init__.py 2020-11-01
14:20:53.000000000 +0100
+++ new/hypothesmith-0.1.8/src/hypothesmith/__init__.py 2021-01-10
13:36:24.000000000 +0100
@@ -3,5 +3,5 @@
from hypothesmith.cst import from_node
from hypothesmith.syntactic import from_grammar
-__version__ = "0.1.6"
+__version__ = "0.1.8"
__all__ = ["from_grammar", "from_node"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/src/hypothesmith/cst.py
new/hypothesmith-0.1.8/src/hypothesmith/cst.py
--- old/hypothesmith-0.1.6/src/hypothesmith/cst.py 2020-11-01
14:20:53.000000000 +0100
+++ new/hypothesmith-0.1.8/src/hypothesmith/cst.py 2021-01-10
13:36:24.000000000 +0100
@@ -7,7 +7,7 @@
import ast
import dis
-from inspect import getfullargspec
+from inspect import getfullargspec, isabstract
from tokenize import (
Floatnumber as FLOATNUMBER_RE,
Imagnumber as IMAGNUMBER_RE,
@@ -16,7 +16,10 @@
from typing import Type
import libcst
-from hypothesis import infer, strategies as st, target
+from hypothesis import assume, infer, strategies as st, target
+from hypothesis.strategies._internal.types import _global_type_lookup
+from libcst._nodes.expression import ExpressionPosition
+from libcst._nodes.statement import _INDENT_WHITESPACE_RE
from hypothesmith.syntactic import identifiers
@@ -65,8 +68,13 @@
# inference to provide most of our arguments for us.
# However, in some cases we want to either restrict arguments (e.g.
libcst.Name),
# or supply something nastier than the default argument (e.g.
libcst.SimpleWhitespace)
+nonempty_whitespace = st.builds(
+ libcst.SimpleWhitespace, st.from_regex(" +", fullmatch=True)
+)
REGISTERED = (
+ [libcst.Asynchronous, nonempty_whitespace],
[libcst.AsName, st.from_type(libcst.Name)],
+ [libcst.AnnAssign, infer, infer, infer],
[libcst.Assign, nonempty_seq(libcst.AssignTarget)],
[libcst.Comparison, infer, nonempty_seq(libcst.ComparisonTarget)],
[libcst.Decorator, st.from_type(libcst.Name) |
st.from_type(libcst.Attribute)],
@@ -78,8 +86,23 @@
st.from_type(libcst.Name) | st.from_type(libcst.Attribute),
nonempty_seq(libcst.ImportAlias),
],
+ [
+ libcst.IndentedBlock,
+ infer,
+ infer,
+ st.from_regex(_INDENT_WHITESPACE_RE, fullmatch=True),
+ ],
+ [libcst.IsNot, infer, nonempty_whitespace, infer],
[libcst.NamedExpr, st.from_type(libcst.Name)],
- [libcst.Nonlocal, nonempty_seq(libcst.NameItem)],
+ [
+ libcst.Nonlocal,
+ nonempty_seq(libcst.NameItem).map(
+ lambda names: names[:-1]
+ + [names[-1].with_changes(comma=libcst.MaybeSentinel.DEFAULT)]
+ ),
+ ],
+ [libcst.NotEqual, st.just("!=")],
+ [libcst.NotIn, infer, nonempty_whitespace, infer],
[libcst.Set, nonempty_seq(libcst.Element, libcst.StarredElement)],
[libcst.Subscript, infer, nonempty_seq(libcst.SubscriptElement)],
[libcst.TrailingWhitespace, infer, infer],
@@ -87,6 +110,14 @@
)
[email protected]
+def builds_filtering(draw, t, **kwargs): # type: ignore
+ try:
+ return draw(st.builds(t, **kwargs))
+ except libcst.CSTValidationError:
+ assume(False)
+
+
# This is where the magic happens: teach `st.from_type` to generate each node
type
for node_type, *strats in REGISTERED:
# TODO: once everything else is working, come back here and use `infer` for
@@ -95,7 +126,7 @@
# Mostly this will consist of ensuring that parens remain balanced.
args = [name for name in getfullargspec(node_type).args if name != "self"]
kwargs = dict(zip(args, strats))
- st.register_type_strategy(node_type, st.builds(node_type, **kwargs))
+ st.register_type_strategy(node_type, builds_filtering(node_type, **kwargs))
# We have special handling for `Try` nodes, because there are two options.
# If a Try node has no `except` clause, it *must* have a `finally` clause and
@@ -108,7 +139,7 @@
libcst.Try,
body=infer,
handlers=st.lists(
- st.from_type(libcst.ExceptHandler),
+ st.deferred(lambda: st.from_type(libcst.ExceptHandler)),
min_size=1,
unique_by=lambda caught: caught.type,
),
@@ -117,6 +148,81 @@
),
)
+# Assert can either have a comma and message, or neither
+st.register_type_strategy(
+ libcst.Assert,
+ st.builds(
+ libcst.Assert,
+ test=infer,
+ whitespace_after_assert=nonempty_whitespace,
+ semicolon=infer,
+ )
+ | st.builds(
+ libcst.Assert,
+ test=infer,
+ whitespace_after_assert=nonempty_whitespace,
+ comma=st.from_type(libcst.Comma),
+ msg=st.from_type(libcst.BaseExpression),
+ semicolon=infer,
+ ),
+)
+
+# either posargs, kwargs, or **args, but only one at a time
+st.register_type_strategy(
+ libcst.Arg,
+ st.builds(
+ libcst.Arg,
+ value=infer,
+ comma=infer,
+ star=infer,
+ whitespace_after_star=infer,
+ whitespace_after_arg=infer,
+ )
+ | st.builds(
+ libcst.Arg,
+ value=infer,
+ keyword=st.from_type(libcst.Name),
+ equal=st.from_type(libcst.AssignEqual),
+ comma=infer,
+ star=st.just(""),
+ whitespace_after_arg=infer,
+ ),
+)
+
+
[email protected]
+def boolean_op_with_whitespace(draw): # type: ignore
+ # for BooleanOperation, some expressions require whitespace before
+ # and/or after e.g. a or b whereas (1)or(2) is OK.
+ left = draw(st.from_type(libcst.BaseExpression))
+ right = draw(st.from_type(libcst.BaseExpression))
+ op = draw(st.from_type(libcst.BaseBooleanOp))
+ if op.whitespace_before.empty and not left._safe_to_use_with_word_operator(
+ ExpressionPosition.LEFT
+ ): # pragma: no cover
+ op = op.with_changes(whitespace_before=libcst.SimpleWhitespace(" "))
+ if op.whitespace_after.empty and not right._safe_to_use_with_word_operator(
+ ExpressionPosition.RIGHT
+ ): # pragma: no cover
+ op = op.with_changes(whitespace_after=libcst.SimpleWhitespace(" "))
+ return libcst.BooleanOperation(left, op, right)
+
+
+st.register_type_strategy(libcst.BooleanOperation,
boolean_op_with_whitespace())
+
+
+# TODO: this works pretty well, but it's also a pretty poor trick for
performance.
+# Instead of filtering, we should continue expanding the specific node
+# strategies as used above in order to generate valid things by
construction.
+for t in vars(libcst).values():
+ if (
+ isinstance(t, type)
+ and not isabstract(t)
+ and issubclass(t, libcst.CSTNode)
+ and t not in _global_type_lookup
+ ):
+ st.register_type_strategy(t, builds_filtering(t))
+
def record_targets(code: str) -> str:
# target larger inputs - the Hypothesis engine will do a multi-objective
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/src/hypothesmith/syntactic.py
new/hypothesmith-0.1.8/src/hypothesmith/syntactic.py
--- old/hypothesmith-0.1.6/src/hypothesmith/syntactic.py 2020-11-01
14:20:53.000000000 +0100
+++ new/hypothesmith-0.1.8/src/hypothesmith/syntactic.py 2021-01-10
13:36:24.000000000 +0100
@@ -117,8 +117,14 @@
# CPython parser and AST-post-processor, so we just filter out
errors.
assume(False)
except Exception as err: # pragma: no cover
- # Extra output to help track down a possible upstream issue
- # https://github.com/Zac-HD/stdlib-property-tests/issues/14
+ # Attempting to compile almost-valid strings has triggered a
wide range
+ # of bizzare errors in CPython, especially with the new PEG
parser,
+ # and so we maintain this extra clause to ensure that we get a
decent
+ # error message out of it.
+ if isinstance(err, SystemError) and sys.version_info[:3] ==
(3, 9, 0):
+ # We've triggered https://bugs.python.org/issue42218 -
it's been
+ # fixed upstream, so we'll treat it as if it were a
SyntaxError.
+ assume(False)
source_code = ascii("".join(draw_state.result[count:]))
raise type(err)(
f"compile({source_code}, '<string>', "
@@ -129,6 +135,8 @@
def gen_ignore(self, data, draw_state): # type: ignore
# Set a consistent 1/4 chance of generating any ignored tokens
(comments,
# whitespace, line-continuations) as part of this draw.
+ # See https://github.com/HypothesisWorks/hypothesis/issues/2643 for
plans
+ # to do more sophisticated swarm testing for grammars, upstream.
if data.draw(
st.shared(
st.sampled_from([False, True, False, False]),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/hypothesmith-0.1.6/src/hypothesmith.egg-info/PKG-INFO
new/hypothesmith-0.1.8/src/hypothesmith.egg-info/PKG-INFO
--- old/hypothesmith-0.1.6/src/hypothesmith.egg-info/PKG-INFO 2020-11-01
14:21:02.000000000 +0100
+++ new/hypothesmith-0.1.8/src/hypothesmith.egg-info/PKG-INFO 2021-01-10
13:36:41.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: hypothesmith
-Version: 0.1.6
+Version: 0.1.8
Summary: Hypothesis strategies for generating Python programs, something like
CSmith
Home-page: https://github.com/Zac-HD/hypothesmith
Author: Zac Hatfield-Dodds
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/hypothesmith-0.1.6/src/hypothesmith.egg-info/SOURCES.txt
new/hypothesmith-0.1.8/src/hypothesmith.egg-info/SOURCES.txt
--- old/hypothesmith-0.1.6/src/hypothesmith.egg-info/SOURCES.txt
2020-11-01 14:21:02.000000000 +0100
+++ new/hypothesmith-0.1.8/src/hypothesmith.egg-info/SOURCES.txt
2021-01-10 13:36:42.000000000 +0100
@@ -1,5 +1,14 @@
+CHANGELOG.md
+LICENSE
+MANIFEST.in
README.md
setup.py
+tox.ini
+deps/README.md
+deps/check.in
+deps/check.txt
+deps/test.in
+deps/test.txt
src/hypothesmith/__init__.py
src/hypothesmith/cst.py
src/hypothesmith/py.typed
@@ -10,4 +19,8 @@
src/hypothesmith.egg-info/dependency_links.txt
src/hypothesmith.egg-info/not-zip-safe
src/hypothesmith.egg-info/requires.txt
-src/hypothesmith.egg-info/top_level.txt
\ No newline at end of file
+src/hypothesmith.egg-info/top_level.txt
+tests/conftest.py
+tests/test_cst.py
+tests/test_syntactic.py
+tests/test_version.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/hypothesmith-0.1.6/src/hypothesmith.egg-info/requires.txt
new/hypothesmith-0.1.8/src/hypothesmith.egg-info/requires.txt
--- old/hypothesmith-0.1.6/src/hypothesmith.egg-info/requires.txt
2020-11-01 14:21:02.000000000 +0100
+++ new/hypothesmith-0.1.8/src/hypothesmith.egg-info/requires.txt
2021-01-10 13:36:41.000000000 +0100
@@ -1,3 +1,3 @@
-hypothesis>=5.39.0
+hypothesis>=5.41.0
lark-parser>=0.7.2
libcst>=0.3.8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/tests/conftest.py
new/hypothesmith-0.1.8/tests/conftest.py
--- old/hypothesmith-0.1.6/tests/conftest.py 1970-01-01 01:00:00.000000000
+0100
+++ new/hypothesmith-0.1.8/tests/conftest.py 2021-01-10 13:36:24.000000000
+0100
@@ -0,0 +1,8 @@
+from hypothesis import HealthCheck, settings
+
+settings.register_profile(
+ "slow",
+ deadline=None,
+ suppress_health_check=[HealthCheck.too_slow, HealthCheck.filter_too_much],
+)
+settings.load_profile("slow")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/tests/test_cst.py
new/hypothesmith-0.1.8/tests/test_cst.py
--- old/hypothesmith-0.1.6/tests/test_cst.py 1970-01-01 01:00:00.000000000
+0100
+++ new/hypothesmith-0.1.8/tests/test_cst.py 2021-01-10 13:36:24.000000000
+0100
@@ -0,0 +1,89 @@
+"""Tests for the hypothesmith.cst module."""
+import ast
+from inspect import isabstract
+from operator import attrgetter
+
+import black
+import libcst
+import parso
+import pytest
+from hypothesis import example, given, note, strategies as st
+
+import hypothesmith
+from hypothesmith.cst import compilable
+
+NODE_TYPES = frozenset(
+ v
+ for v in vars(libcst).values()
+ if isinstance(v, type) and issubclass(v, libcst.CSTNode) and not
isabstract(v)
+)
+
+
[email protected]("node", sorted(NODE_TYPES,
key=attrgetter("__name__")))
+@given(data=st.data())
+def test_source_code_from_libcst_node_type(node, data):
+ try:
+ val = data.draw(st.from_type(node))
+ except NameError:
+ pytest.skip("NameError, probably a forward reference")
+ except TypeError as e:
+ if str(e).startswith("super"):
+ pytest.skip("something weird here, back later")
+ if str(e).startswith("Can't instantiate"):
+ pytest.skip("abstract classes somehow leaking into builds()")
+ raise
+ note(val)
+ if not isinstance(val, libcst.Module):
+ val = libcst.Module([val])
+ try:
+ code = val.code
+ except libcst._nodes.base.CSTCodegenError:
+ pytest.skip("codegen not supported yet, e.g. Annotation")
+ note(code)
+
+
[email protected](not hasattr(ast, "unparse"), reason="Can't test before
available")
+@given(source_code=hypothesmith.from_node())
+def test_ast_unparse_from_nodes(source_code):
+ first = ast.parse(source_code)
+ unparsed = ast.unparse(first)
+ second = ast.parse(unparsed)
+ assert ast.dump(first) == ast.dump(second)
+
+
[email protected]
+@example("A\u2592", black.FileMode())
+@given(
+ source_code=hypothesmith.from_node(),
+ mode=st.builds(
+ black.FileMode,
+ line_length=st.just(88) | st.integers(0, 200),
+ string_normalization=st.booleans(),
+ is_pyi=st.booleans(),
+ ),
+)
+def test_black_autoformatter_from_nodes(source_code, mode):
+ try:
+ result = black.format_file_contents(source_code, fast=False, mode=mode)
+ except black.NothingChanged:
+ pass
+ else:
+ with pytest.raises(black.NothingChanged):
+ black.format_file_contents(result, fast=False, mode=mode)
+
+
+@given(source_code=hypothesmith.from_node())
+def test_from_node_always_compilable(source_code):
+ compile(source_code, "<string>", "exec")
+
+
+@example("\x00")
+@given(st.text())
+def test_compilable_never_raises(s):
+ compilable(s)
+
+
+@given(source_code=hypothesmith.from_node())
+def test_parso_from_node(source_code):
+ result = parso.parse(source_code).get_code()
+ assert source_code == result
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/tests/test_syntactic.py
new/hypothesmith-0.1.8/tests/test_syntactic.py
--- old/hypothesmith-0.1.6/tests/test_syntactic.py 1970-01-01
01:00:00.000000000 +0100
+++ new/hypothesmith-0.1.8/tests/test_syntactic.py 2021-01-10
13:36:24.000000000 +0100
@@ -0,0 +1,108 @@
+"""Tests for the hypothesmith.syntactic module."""
+import ast
+import io
+import tokenize
+
+import black
+import blib2to3
+import parso
+import pytest
+from hypothesis import example, given, reject, strategies as st
+
+import hypothesmith
+
+
+def fixup(s):
+ """Avoid known issues with tokenize() by editing the string."""
+ return "".join(x for x in s if
x.isprintable()).strip().strip("\\").strip() + "\n"
+
+
[email protected]
+@example("#")
+@example("\n\\\n")
+@example("#\n\x0cpass#\n")
+@given(source_code=hypothesmith.from_grammar().map(fixup).filter(str.strip))
+def test_tokenize_round_trip_bytes(source_code):
+ try:
+ source = source_code.encode("utf-8-sig")
+ except UnicodeEncodeError:
+ reject()
+ tokens = list(tokenize.tokenize(io.BytesIO(source).readline))
+ outbytes = tokenize.untokenize(tokens) # may have changed whitespace from
source
+ output = list(tokenize.tokenize(io.BytesIO(outbytes).readline))
+ assert [(t.type, t.string) for t in tokens] == [(t.type, t.string) for t
in output]
+ # It would be nice if the round-tripped string stabilised. It doesn't.
+ # assert outbytes == tokenize.untokenize(output)
+
+
[email protected]
+@example("#")
+@example("\n\\\n")
+@example("#\n\x0cpass#\n")
+@given(source_code=hypothesmith.from_grammar().map(fixup).filter(str.strip))
+def test_tokenize_round_trip_string(source_code):
+ tokens = list(tokenize.generate_tokens(io.StringIO(source_code).readline))
+ outstring = tokenize.untokenize(tokens) # may have changed whitespace
from source
+ output = tokenize.generate_tokens(io.StringIO(outstring).readline)
+ assert [(t.type, t.string) for t in tokens] == [(t.type, t.string) for t
in output]
+ # It would be nice if the round-tripped string stabilised. It doesn't.
+ # assert outstring == tokenize.untokenize(output)
+
+
[email protected](not hasattr(ast, "unparse"), reason="Can't test before
available")
+@given(source_code=hypothesmith.from_grammar())
+def test_ast_unparse_from_grammar(source_code):
+ first = ast.parse(source_code)
+ unparsed = ast.unparse(first)
+ second = ast.parse(unparsed)
+ assert ast.dump(first) == ast.dump(second)
+
+
+@example("\\", black.FileMode())
+@example("A#\r#", black.FileMode())
+@given(
+ source_code=hypothesmith.from_grammar(),
+ mode=st.builds(
+ black.FileMode,
+ line_length=st.just(88) | st.integers(0, 200),
+ string_normalization=st.booleans(),
+ is_pyi=st.booleans(),
+ ),
+)
+def test_black_autoformatter_from_grammar(source_code, mode):
+ try:
+ result = black.format_file_contents(source_code, fast=False, mode=mode)
+ except black.NothingChanged:
+ pass
+ except blib2to3.pgen2.tokenize.TokenError:
+ # Fails to tokenise e.g. "\\", though compile("\\", "<string>",
"exec") works.
+ # See https://github.com/psf/black/issues/1012
+ reject()
+ except black.InvalidInput:
+ # e.g. "A#\r#", see https://github.com/psf/black/issues/970
+ reject()
+ else:
+ with pytest.raises(black.NothingChanged):
+ black.format_file_contents(result, fast=False, mode=mode)
+
+
+@given(source_code=hypothesmith.from_grammar("eval_input"))
+def test_eval_input_generation(source_code):
+ compile(source_code, filename="<string>", mode="eval")
+
+
+@given(source_code=hypothesmith.from_grammar(auto_target=False))
+def test_generation_without_targeting(source_code):
+ compile(source_code, filename="<string>", mode="exec")
+
+
+@given(hypothesmith.syntactic.identifiers())
+def test_names_are_all_identifiers(name):
+ assert name.isidentifier()
+ name.encode() # should be UTF-8 encodable
+
+
+@given(source_code=hypothesmith.from_grammar())
+def test_parso_from_node(source_code):
+ result = parso.parse(source_code).get_code()
+ assert source_code == result
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/tests/test_version.py
new/hypothesmith-0.1.8/tests/test_version.py
--- old/hypothesmith-0.1.6/tests/test_version.py 1970-01-01
01:00:00.000000000 +0100
+++ new/hypothesmith-0.1.8/tests/test_version.py 2021-01-10
13:36:24.000000000 +0100
@@ -0,0 +1,54 @@
+"""Tests for the hypothesmith package metadata."""
+import re
+from datetime import date
+from functools import lru_cache
+from pathlib import Path
+from typing import NamedTuple
+
+import hypothesmith
+
+
+class Version(NamedTuple):
+ major: int
+ minor: int
+ patch: int
+
+ @classmethod
+ def from_string(cls, string):
+ return cls(*map(int, string.split(".")))
+
+
+@lru_cache()
+def get_releases():
+ pattern = re.compile(r"^### (\d+\.\d+\.\d+) - (\d\d\d\d-\d\d-\d\d)$")
+ with open(Path(__file__).parent.parent / "CHANGELOG.md") as f:
+ return tuple(
+ (Version.from_string(match.group(1)), match.group(2))
+ for match in map(pattern.match, f)
+ if match is not None
+ )
+
+
+def test_last_release_against_changelog():
+ last_version, last_date = get_releases()[0]
+ assert last_version == Version.from_string(hypothesmith.__version__)
+ assert last_date <= date.today().isoformat()
+
+
+def test_changelog_is_ordered():
+ versions, dates = zip(*get_releases())
+ assert versions == tuple(sorted(versions, reverse=True))
+ assert dates == tuple(sorted(dates, reverse=True))
+
+
+def test_version_increments_are_correct():
+ # We either increment the patch version by one, increment the minor version
+ # and reset the patch, or increment major and reset both minor and patch.
+ versions, _ = zip(*get_releases())
+ for prev, current in zip(versions[1:], versions):
+ assert prev < current # remember that `versions` is newest-first
+ assert current in (
+ prev._replace(patch=prev.patch + 1),
+ prev._replace(minor=prev.minor + 1, patch=0),
+ prev._replace(major=prev.major + 1, minor=0, patch=0),
+ ), f"{current} does not follow {prev}"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/hypothesmith-0.1.6/tox.ini
new/hypothesmith-0.1.8/tox.ini
--- old/hypothesmith-0.1.6/tox.ini 1970-01-01 01:00:00.000000000 +0100
+++ new/hypothesmith-0.1.8/tox.ini 2021-01-10 13:36:24.000000000 +0100
@@ -0,0 +1,75 @@
+# The test environment and commands
+[tox]
+envlist = check, test
+skipsdist = True
+
+[testenv:check]
+description = Runs all formatting tools then static analysis (quick)
+deps =
+ --no-deps
+ --requirement deps/check.txt
+ com2ann ; python_version >= '3.8'
+commands =
+ shed
+ flake8
+ mypy --config-file=tox.ini . src/
+
+[testenv:test]
+description = Runs pytest with posargs - `tox -e test -- -v` == `pytest -v`
+deps =
+ --no-deps
+ --requirement deps/test.txt
+ # We need this line here because pip-compile doesn't propogate env markers
+ dataclasses>=0.7 ; python_version < '3.7'
+commands =
+ pip install --no-deps --editable .
+ pytest {posargs:-n auto}
+
+# Run `tox -e deps` to update pinned dependencies
+[testenv:deps]
+description = Updates pinned dependencies in the `deps/*.txt` files
+deps =
+ pip-tools
+commands =
+ pip-compile --quiet --rebuild --upgrade --output-file=deps/check.txt
deps/check.in
+ pip-compile --quiet --rebuild --upgrade --output-file=deps/test.txt
deps/test.in setup.py
+
+
+# Settings for other tools
+[pytest]
+addopts =
+ -Werror
+ --tb=short
+ --cov=hypothesmith
+ --cov-branch
+ --cov-report=term-missing:skip-covered
+ --cov-fail-under=100
+
+[flake8]
+ignore = D1,E501,W503,S101,S310
+exclude = .*,__pycache__
+
+[isort]
+known_first_party = hypothesmith
+default_section = THIRDPARTY
+multi_line_output = 3
+include_trailing_comma = True
+force_grid_wrap = 0
+combine_as_imports = True
+line_length = 88
+
+[mypy]
+python_version = 3.6
+platform = linux
+disallow_untyped_calls = True
+disallow_untyped_defs = True
+disallow_untyped_decorators = True
+follow_imports = silent
+ignore_missing_imports = True
+warn_no_return = True
+warn_return_any = True
+warn_unused_ignores = True
+warn_unused_configs = True
+warn_redundant_casts = True
+[mypy-test_hypothesmith]
+ignore_errors = True