[Git][debian-gis-team/python-snuggs][upstream] 2 commits: New upstream version 1.4.4

Bas Couwenberg gitlab at salsa.debian.org
Wed May 15 05:40:00 BST 2019



Bas Couwenberg pushed to branch upstream at Debian GIS Project / python-snuggs


Commits:
bfa8e090 by Bas Couwenberg at 2019-05-15T04:22:18Z
New upstream version 1.4.4
- - - - -
d9535db2 by Bas Couwenberg at 2019-05-15T04:22:37Z
New upstream version 1.4.5
- - - - -


5 changed files:

- .travis.yml
- CHANGES.txt
- setup.py
- snuggs/__init__.py
- test_snuggs.py


Changes:

=====================================
.travis.yml
=====================================
@@ -1,10 +1,11 @@
+dist: xenial
 language: python
 python:
-  - "2.7"
   - "3.6"
+  - "3.7"
 install:
-  - "pip install pytest-cov coveralls"
-  - "pip install -e ."
+  - "pip install pytest-cov coveralls pyparsing==2.3.1"
+  - "pip install -e .[test]"
 script: 
   - python -m pytest --cov snuggs --cov-report term-missing
 after_success:


=====================================
CHANGES.txt
=====================================
@@ -1,6 +1,17 @@
 Changes
 =======
 
+1.4.5 (2019-05-14)
+------------------
+- Replace custom integer and real parsers with pyparsing_common's number (#19).
+
+1.4.4 (2019-05-14)
+------------------
+- Fix for a reported bug in parsing negative real numbers (#16) and for an
+  unreported bug in parsing numbers in exponential notation (thank you,
+  hypothesis!).
+- Add a "test" dependency on hypothesis.
+
 1.4.3 (2019-02-25)
 ------------------
 - Add LICENSE to distributions (#11).


=====================================
setup.py
=====================================
@@ -29,6 +29,6 @@ setup(
     packages=find_packages(exclude=["ez_setup", "examples", "tests"]),
     include_package_data=True,
     zip_safe=False,
-    install_requires=["numpy", "pyparsing"],
-    extras_require={"test": ["pytest"]},
+    install_requires=["numpy", "pyparsing>=2.1.6"],
+    extras_require={"test": ["pytest", "hypothesis"]},
 )


=====================================
snuggs/__init__.py
=====================================
@@ -16,7 +16,7 @@ import numpy
 
 
 __all__ = ['eval']
-__version__ = "1.4.3"
+__version__ = "1.4.5"
 
 # Python 2-3 compatibility
 string_types = (str,) if sys.version_info[0] >= 3 else (basestring,)  # flake8: noqa
@@ -121,15 +121,6 @@ def resolve_var(s, l, t):
 
 var = name.setParseAction(resolve_var)
 
-integer = Combine(
-    Optional(sign) +
-    number).setParseAction(lambda s, l, t: int(t[0]))
-
-real = Combine(
-    integer +
-    decimal + Optional(number) +
-    Optional(e + integer)).setParseAction(lambda s, l, t: float(t[0]))
-
 string = QuotedString("'") | QuotedString('"')
 
 lparen = Literal('(').suppress()
@@ -159,7 +150,7 @@ func_expr = Forward()
 higher_func_expr = Forward()
 expr = higher_func_expr | func_expr
 
-operand = higher_func_expr | func_expr | nil | var | real | integer | string
+operand = higher_func_expr | func_expr | nil | var | pyparsing_common.number | string
 
 func_expr << Group(
     lparen +


=====================================
test_snuggs.py
=====================================
@@ -1,19 +1,36 @@
 from collections import OrderedDict
 
+from hypothesis import given
+from hypothesis.strategies import floats, integers
 import numpy
 import pytest
 
 import snuggs
 
-# Fixtures follow the tests. See the end of the file.
+
+ at pytest.fixture
+def ones():
+    return numpy.ones((2, 2))
+
+
+ at pytest.fixture
+def truetrue():
+    return numpy.array([True, True])
+
+
+ at pytest.fixture
+def truefalse():
+    return numpy.array([True, False])
 
 
-def test_integer():
-    assert list(snuggs.integer.parseString('1')) == [1]
+ at given(integers())
+def test_integer_operand(num):
+    assert list(snuggs.operand.parseString(str(num))) == [num]
 
 
-def test_real():
-    assert list(snuggs.real.parseString('1.1')) == [1.1]
+ at given(floats(allow_infinity=False, allow_nan=False))
+def test_real_operand(num):
+    assert list(snuggs.operand.parseString(str(num))) == [num]
 
 
 def test_int_expr():
@@ -225,17 +242,6 @@ def test_type_error():
         snuggs.eval("(+ 1 'bogus')")
 
 
-# Fixtures.
- at pytest.fixture
-def ones():
-    return numpy.ones((2, 2))
-
-
- at pytest.fixture
-def truetrue():
-    return numpy.array([True, True])
-
-
- at pytest.fixture
-def truefalse():
-    return numpy.array([True, False])
+def test_negative_decimal():
+    """Negative decimals parse correctly"""
+    assert snuggs.eval("(< -0.9 0)")



View it on GitLab: https://salsa.debian.org/debian-gis-team/python-snuggs/compare/23d63cb6a5f28de1deeb8b9afd8d8775aa1d4623...d9535db27ae5bc20f234590e71dc3922c55734ce

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-snuggs/compare/23d63cb6a5f28de1deeb8b9afd8d8775aa1d4623...d9535db27ae5bc20f234590e71dc3922c55734ce
You're receiving this email because of your account on salsa.debian.org.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20190515/29d85d87/attachment-0001.html>


More information about the Pkg-grass-devel mailing list