Hello community,

here is the log from the commit of package python-dephell-markers for 
openSUSE:Factory checked in at 2019-09-13 15:03:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-dephell-markers (Old)
 and      /work/SRC/openSUSE:Factory/.python-dephell-markers.new.7948 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-dephell-markers"

Fri Sep 13 15:03:42 2019 rev:2 rq:730646 version:1.0.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-dephell-markers/python-dephell-markers.changes
    2019-08-13 13:26:48.893330747 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-dephell-markers.new.7948/python-dephell-markers.changes
  2019-09-13 15:05:09.385258802 +0200
@@ -1,0 +2,6 @@
+Fri Sep 13 09:10:21 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 1.0.0:
+  * ship tests
+
+-------------------------------------------------------------------

Old:
----
  dephell_markers-0.2.5.tar.gz

New:
----
  dephell_markers-1.0.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-dephell-markers.spec ++++++
--- /var/tmp/diff_new_pack.w2NTU5/_old  2019-09-13 15:05:10.453258575 +0200
+++ /var/tmp/diff_new_pack.w2NTU5/_new  2019-09-13 15:05:10.457258574 +0200
@@ -12,33 +12,34 @@
 # 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/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
 
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-dephell-markers
-Version:        0.2.5
+Version:        1.0.0
 Release:        0
-License:        MIT
 Summary:        Dephell library to use environment markers (PEP-496)
-Url:            https://github.com/dephell/dephell_markers
+License:        MIT
 Group:          Development/Languages/Python
-Source:         
https://files.pythonhosted.org/packages/source/d/dephell-markers/dephell_markers-%{version}.tar.gz
-BuildRequires:  python-rpm-macros
+URL:            https://github.com/dephell/dephell_markers
+Source:         
https://files.pythonhosted.org/packages/source/d/dephell_markers/dephell_markers-%{version}.tar.gz
 BuildRequires:  %{python_module base >= 3.5}
 BuildRequires:  %{python_module setuptools}
-# SECTION test requirements
-BuildRequires:  %{python_module attrs}
-BuildRequires:  %{python_module dephell-specifier}
-BuildRequires:  %{python_module packaging}
-# /SECTION
 BuildRequires:  fdupes
+BuildRequires:  python-rpm-macros
 Requires:       python-attrs
 Requires:       python-dephell-specifier
 Requires:       python-packaging
 BuildArch:      noarch
-
+# SECTION test requirements
+BuildRequires:  %{python_module attrs}
+BuildRequires:  %{python_module dephell-specifier}
+BuildRequires:  %{python_module packaging}
+BuildRequires:  %{python_module pytest}
+# /SECTION
 %python_subpackages
 
 %description
@@ -54,6 +55,9 @@
 %python_install
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
+%check
+%pytest
+
 %files %{python_files}
 %license LICENSE
 %doc README.md

++++++ dephell_markers-0.2.5.tar.gz -> dephell_markers-1.0.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_markers-0.2.5/PKG-INFO 
new/dephell_markers-1.0.0/PKG-INFO
--- old/dephell_markers-0.2.5/PKG-INFO  1970-01-01 01:00:00.000000000 +0100
+++ new/dephell_markers-1.0.0/PKG-INFO  1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
-Name: dephell_markers
-Version: 0.2.5
+Name: dephell-markers
+Version: 1.0.0
 Summary: Work with environment markers (PEP-496)
 Project-URL: Repository, https://github.com/dephell/dephell_markers
 Author: Gram
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_markers-0.2.5/dephell_markers/_markers.py 
new/dephell_markers-1.0.0/dephell_markers/_markers.py
--- old/dephell_markers-0.2.5/dephell_markers/_markers.py       2019-04-19 
13:21:45.000000000 +0200
+++ new/dephell_markers-1.0.0/dephell_markers/_markers.py       2019-07-07 
12:42:43.000000000 +0200
@@ -5,7 +5,7 @@
 # external
 from dephell_specifier import RangeSpecifier
 from packaging import markers as packaging
-from packaging.markers import Variable
+from packaging.markers import Variable, Op, Value
 
 # app
 from ._marker import BaseMarker, StringMarker, VersionMarker
@@ -141,18 +141,7 @@
         for marker in markers:
             # single marker
             if isinstance(marker, tuple):
-                lhs, op, rhs = marker
-                var = lhs.value if isinstance(lhs, Variable) else rhs.value
-                if var in STRING_VARIABLES:
-                    marker_cls = StringMarker  # type: Type[BaseMarker]
-                elif var in VERSION_VARIABLES:
-                    if op.value in {'in', 'not in'}:
-                        msg = 'unsupported operation for version marker {}: {}'
-                        raise ValueError(msg.format(var, op.value))
-                    marker_cls = VersionMarker
-                else:
-                    raise LookupError('unknown marker: {}'.format(var))
-                groups[-1].append(marker_cls(lhs=lhs, op=op, rhs=rhs))
+                groups[-1].append(cls._convert_single_marker(*marker))
                 continue
 
             # sub-collection
@@ -180,6 +169,27 @@
         return OrMarker(*cls._deduplicate(new_groups))
 
     @staticmethod
+    def _convert_single_marker(lhs: Union[Value, Variable], op: Op,
+                               rhs: Union[Value, Variable]) -> 
Union[Operation, BaseMarker]:
+        var = lhs.value if type(lhs) is Variable else rhs.value
+        if var in STRING_VARIABLES:
+            return StringMarker(lhs=lhs, op=op, rhs=rhs)
+
+        if var not in VERSION_VARIABLES:
+            raise LookupError('unknown marker: {}'.format(var))
+
+        if op.value == 'in' and type(rhs) is Value:
+            values = rhs.value.split()
+            markers = [VersionMarker(lhs=lhs, op=Op('=='), rhs=Value(value)) 
for value in values]
+            return OrMarker(*markers)
+
+        if op.value in {'in' 'not in'}:
+            msg = 'unsupported operation for version marker {}: {}'
+            raise ValueError(msg.format(var, op.value))
+
+        return VersionMarker(lhs=lhs, op=op, rhs=rhs)
+
+    @staticmethod
     def _deduplicate(group: list) -> list:
         new_group = []  # type: list
         for node in group:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/dephell_markers-0.2.5/dephell_markers.egg-info/PKG-INFO 
new/dephell_markers-1.0.0/dephell_markers.egg-info/PKG-INFO
--- old/dephell_markers-0.2.5/dephell_markers.egg-info/PKG-INFO 1970-01-01 
01:00:00.000000000 +0100
+++ new/dephell_markers-1.0.0/dephell_markers.egg-info/PKG-INFO 1970-01-01 
01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
-Name: dephell_markers
-Version: 0.2.5
+Name: dephell-markers
+Version: 1.0.0
 Summary: Work with environment markers (PEP-496)
 Project-URL: Repository, https://github.com/dephell/dephell_markers
 Author: Gram
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_markers-0.2.5/setup.py 
new/dephell_markers-1.0.0/setup.py
--- old/dephell_markers-0.2.5/setup.py  2019-05-19 14:53:22.000000000 +0200
+++ new/dephell_markers-1.0.0/setup.py  2019-07-07 12:43:28.000000000 +0200
@@ -13,13 +13,15 @@
 
 readme = ''
 here = os.path.abspath(os.path.dirname(__file__))
-with open(os.path.join(here, 'README.rst'), 'rb') as stream:
-    readme = stream.read().decode('utf8')
+readme_path = os.path.join(here, 'README.rst')
+if os.path.exists(readme_path):
+    with open(readme_path, 'rb') as stream:
+        readme = stream.read().decode('utf8')
 
 setup(
     long_description=readme,
     name='dephell_markers',
-    version='0.2.5',
+    version='1.0.0',
     description='Work with environment markers (PEP-496)',
     python_requires='>=3.5',
     project_urls={'repository': 'https://github.com/dephell/dephell_markers'},
Binary files 
old/dephell_markers-0.2.5/tests/__pycache__/__init__.cpython-35.pyc and 
new/dephell_markers-1.0.0/tests/__pycache__/__init__.cpython-35.pyc differ
Binary files 
old/dephell_markers-0.2.5/tests/__pycache__/__init__.cpython-37.pyc and 
new/dephell_markers-1.0.0/tests/__pycache__/__init__.cpython-37.pyc differ
Binary files 
old/dephell_markers-0.2.5/tests/__pycache__/test_markers.cpython-35-PYTEST.pyc 
and 
new/dephell_markers-1.0.0/tests/__pycache__/test_markers.cpython-35-PYTEST.pyc 
differ
Binary files 
old/dephell_markers-0.2.5/tests/__pycache__/test_markers.cpython-37-PYTEST.pyc 
and 
new/dephell_markers-1.0.0/tests/__pycache__/test_markers.cpython-37-PYTEST.pyc 
differ
Binary files 
old/dephell_markers-0.2.5/tests/__pycache__/test_string.cpython-35-PYTEST.pyc 
and 
new/dephell_markers-1.0.0/tests/__pycache__/test_string.cpython-35-PYTEST.pyc 
differ
Binary files 
old/dephell_markers-0.2.5/tests/__pycache__/test_string.cpython-37-PYTEST.pyc 
and 
new/dephell_markers-1.0.0/tests/__pycache__/test_string.cpython-37-PYTEST.pyc 
differ
Binary files 
old/dephell_markers-0.2.5/tests/__pycache__/test_version.cpython-35-PYTEST.pyc 
and 
new/dephell_markers-1.0.0/tests/__pycache__/test_version.cpython-35-PYTEST.pyc 
differ
Binary files 
old/dephell_markers-0.2.5/tests/__pycache__/test_version.cpython-37-PYTEST.pyc 
and 
new/dephell_markers-1.0.0/tests/__pycache__/test_version.cpython-37-PYTEST.pyc 
differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_markers-0.2.5/tests/test_markers.py 
new/dephell_markers-1.0.0/tests/test_markers.py
--- old/dephell_markers-0.2.5/tests/test_markers.py     1970-01-01 
01:00:00.000000000 +0100
+++ new/dephell_markers-1.0.0/tests/test_markers.py     2019-07-07 
12:42:43.000000000 +0200
@@ -0,0 +1,204 @@
+# external
+import pytest
+
+# project
+from dephell_markers import Markers
+
+
[email protected]('marker, value', [
+    ('os_name == "posix"', 'posix'),
+    ('os_name == "posix" and os_name == "posix"', 'posix'),
+    ('os_name == "posix" or os_name == "posix"', 'posix'),
+    ('os_name == "posix" and python_version >= "2.7"', 'posix'),
+
+    ('os_name == "posix" and os_name == "nt"', None),
+    ('os_name == "nt" and os_name != "nt"', None),
+    ('os_name == "posix" or python_version >= "2.7"', None),
+])
+def test_get_string(marker, value):
+    m = Markers(marker)
+    v = m.get_string(name='os_name')
+    assert v == value
+
+
[email protected]('marker, value', [
+    ('python_version == "2.4"', '==2.4'),
+    ('python_version in "2.4"', '==2.4'),
+    ('python_version >= "2.4" and python_version <= "2.7"', '<=2.7,>=2.4'),
+    ('python_version >= "2.4" or python_version <= "2.7"', '<=2.7 || >=2.4'),
+    ('python_version == "2.4" and os_name == "linux"', '==2.4'),
+
+    # `or` contains different marker
+    ('python_version == "2.4" or os_name == "linux"', None),
+    # no needed marker
+    ('os_name == "linux"', None),
+])
+def test_get_version(marker, value):
+    m = Markers(marker)
+    v = m.get_version(name='python_version')
+    assert v == value
+
+
+def test_python_version():
+    m = Markers('python_version >= "2.4" and python_version <= "2.7"')
+    v = m.python_version
+    assert '2.4' in v
+    assert '2.5' in v
+    assert '2.3' not in v
+    assert '3.4' not in v
+
+
+def test_python_version_in():
+    m = Markers('python_version in "2.4 2.6"')
+    v = m.python_version
+    assert '2.3' not in v
+    assert '2.4' in v
+    assert '2.5' not in v
+    assert '2.6' in v
+
+
+def test_add_python_version():
+    m = Markers('python_version >= "2.4"')
+    assert '3.2' in m.python_version
+    m.add(name='python_version', operator='<=', value='2.7')
+    v = m.python_version
+    assert '2.4' in v
+    assert '2.5' in v
+    assert '2.3' not in v
+    assert '3.4' not in v
+
+
[email protected]('given, expected', [
+    (
+        'python_version >= "2.4" and python_version <= "2.7"',
+        'python_version >= "2.4" and python_version <= "2.7"',
+    ),
+    (
+        '(python_version >= "2.4" and python_version <= "2.7")',
+        'python_version >= "2.4" and python_version <= "2.7"',
+    ),
+    (
+        '(python_version >= "2.4" or python_version <= "2.7") or os_name == 
"linux"',
+        'python_version >= "2.4" or python_version <= "2.7" or os_name == 
"linux"',
+    ),
+    (
+        '(python_version>="2.4" and python_version <= "2.7") or os_name == 
"linux"',
+        'python_version >= "2.4" and python_version <= "2.7" or os_name == 
"linux"',
+    ),
+    (
+        '(python_version < "3" or python_version >= "3.3") and extra == 
"docs"',
+        '(python_version < "3" or python_version >= "3.3") and extra == 
"docs"',
+    ),
+])
+def test_str(given, expected):
+    m = Markers(given)
+    assert str(m) == expected
+
+
[email protected]('given, expected', [
+    ('os_name == "posix" and os_name == "posix"', 'os_name == "posix"'),
+    ('os_name == "posix" or os_name == "posix"', 'os_name == "posix"'),
+
+    ('os_name == "posix" and os_name == "win"', 'os_name == "posix" and 
os_name == "win"'),
+    ('os_name == "posix" or os_name == "win"', 'os_name == "posix" or os_name 
== "win"'),
+
+    (
+        '(os_name == "nt" and sys_platform != "linux") or (os_name == "nt" and 
sys_platform != "linux")',
+        'os_name == "nt" and sys_platform != "linux"',
+    ),
+    (
+        'os_name == "nt" and sys_platform != "linux" and os_name == "nt" and 
sys_platform != "linux"',
+        'os_name == "nt" and sys_platform != "linux"',
+    ),
+    (
+        'os_name == "nt" and sys_platform != "linux" or os_name == "nt" and 
sys_platform == "linux"',
+        'os_name == "nt" and sys_platform != "linux" or os_name == "nt" and 
sys_platform == "linux"',
+    ),
+])
+def test_simplify_the_same(given, expected):
+    m = Markers(given)
+    assert str(m) == expected
+
+
[email protected]('left, right, expected', [
+    ('os_name == "nt"', 'sys_platform != "linux"', 'os_name == "nt" and 
sys_platform != "linux"'),
+    ('os_name == "nt"', 'os_name == "nt"', 'os_name == "nt"'),
+])
+def test_and(left, right, expected):
+    assert str(Markers(left) & Markers(right)) == str(Markers(expected))
+    # inplace
+    m = Markers(left)
+    m &= Markers(right)
+    assert str(m) == str(Markers(expected))
+
+
[email protected]('left, right, expected', [
+    ('os_name == "nt"', 'sys_platform != "linux"', 'os_name == "nt" or 
sys_platform != "linux"'),
+    ('os_name == "nt"', 'os_name == "nt"', 'os_name == "nt"'),
+])
+def test_or(left, right, expected):
+    assert str(Markers(left) | Markers(right)) == str(Markers(expected))
+    # inplace
+    m = Markers(left)
+    m |= Markers(right)
+    assert str(m) == str(Markers(expected))
+
+
[email protected]('marker, expected', [
+    ('os_name == "nt" and sys_platform != "linux"', {'os_name', 
'sys_platform'}),
+    ('os_name == "nt" and os_name != "nt"', {'os_name'}),
+    ('os_name == "nt" and os_name != "unix"', {'os_name'}),
+    ('os_name == "nt" and os_name == "unix"', {'os_name'}),
+])
+def test_variables(marker, expected):
+    assert Markers(marker).variables == expected
+
+
[email protected]('marker, ok', [
+    ('os_name == "nt" and sys_platform == "linux"', True),
+    ('os_name == "nt" and os_name == "posix"', False),
+    # ('os_name == "nt" and sys_platform != "linux"', True),
+    ('os_name == "nt" and os_name != "nt"', False),
+    ('os_name == "nt" and os_name != "unix"', True),
+
+    ('python_version >= "2.7" and python_version >= "3.4"', True),
+    ('python_version >= "2.7" and python_version <= "3.4"', True),
+    ('python_version <= "2.7" and python_version >= "3.4"', False),
+    ('python_version <= "2.7" or python_version >= "3.4"', True),
+])
+def test_compat(marker, ok):
+    assert Markers(marker).compat is ok
+
+
[email protected]('marker, values', [
+    ('extra == "lol"', {'lol'}),
+    ('os_name == "nt"', set()),
+    ('extra == "lol" and extra != "lal"', {'lol'}),
+    ('extra == "lol" and extra == "lal"', {'lol', 'lal'}),
+    ('extra == "lol" or extra == "lal"', {'lol', 'lal'}),
+    ('extra == "lol" and extra == "lal" or extra == "nani"', {'lol', 'lal', 
'nani'}),
+])
+def test_get_strings(marker, values):
+    assert Markers(marker).get_strings('extra') == values
+
+
[email protected]('before, after', [
+    ('os_name == "nt"', 'os_name == "nt"'),
+    ('os_name == "nt" and extra == "lol"', 'os_name == "nt"'),
+    ('os_name == "nt" or extra == "lol"', 'os_name == "nt"'),
+    ('extra == "lol"', ''),
+])
+def test_remove(before, after):
+    marker = Markers(before)
+    marker.remove('extra')
+    assert str(marker) == after
+
+
+def test_empty():
+    m = Markers()
+    assert str(m) == ''
+    assert bool(m) is False
+
+    m &= Markers('os_name == "nt"')
+    assert str(m) == 'os_name == "nt"'
+    assert bool(m) is True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_markers-0.2.5/tests/test_string.py 
new/dephell_markers-1.0.0/tests/test_string.py
--- old/dephell_markers-0.2.5/tests/test_string.py      1970-01-01 
01:00:00.000000000 +0100
+++ new/dephell_markers-1.0.0/tests/test_string.py      2019-03-24 
18:16:50.000000000 +0100
@@ -0,0 +1,47 @@
+# external
+import pytest
+from packaging.markers import Op, Value, Variable
+
+# project
+from dephell_markers import StringMarker
+
+
[email protected]('op, val, expected', [
+    ('==', 'posix', 'os_name == "posix"'),
+])
+def test_specifier(op, val, expected):
+    m = StringMarker(
+        lhs=Variable('os_name'),
+        op=Op(op),
+        rhs=Value(val),
+    )
+    assert str(m) == expected
+
+
[email protected]('left_op, left_val, right_op, right_val, result', [
+    ('==', 'posix',     '==', 'posix',  'os_name == "posix"'),
+    ('==', 'posix',     '>=', 'posix',  'os_name == "posix"'),
+    ('==', 'posix',     '<=', 'posix',  'os_name == "posix"'),
+    ('<=', 'posix',     '==', 'posix',  'os_name == "posix"'),
+    ('>=', 'posix',     '<=', 'posix',  'os_name == "posix"'),
+
+    ('>', 'posix',      '<', 'posix',   None),
+    ('==', 'posix',     '==', 'win',    None),
+])
+def test_merge(left_op, left_val, right_op, right_val, result):
+    lm = StringMarker(
+        lhs=Variable('os_name'),
+        op=Op(left_op),
+        rhs=Value(left_val),
+    )
+    rm = StringMarker(
+        lhs=Variable('os_name'),
+        op=Op(right_op),
+        rhs=Value(right_val),
+    )
+    if result is None:
+        with pytest.raises(TypeError):
+            lm + rm
+    else:
+        merged = lm + rm
+        assert str(merged) == result
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_markers-0.2.5/tests/test_version.py 
new/dephell_markers-1.0.0/tests/test_version.py
--- old/dephell_markers-0.2.5/tests/test_version.py     1970-01-01 
01:00:00.000000000 +0100
+++ new/dephell_markers-1.0.0/tests/test_version.py     2019-03-24 
18:16:50.000000000 +0100
@@ -0,0 +1,64 @@
+# external
+import pytest
+from packaging.markers import Op, Value, Variable
+
+# project
+from dephell_markers import VersionMarker
+
+
[email protected]('op, val, expected', [
+    ('>=', '1.3', '>=1.3'),
+    ('>', '1.3', '>1.3'),
+    ('===', '1.3', '===1.3'),
+    ('~=', '1.3', '~=1.3'),
+])
+def test_specifier(op, val, expected):
+    m = VersionMarker(
+        lhs=Variable('python_version'),
+        op=Op(op),
+        rhs=Value(val),
+    )
+    assert str(m.specifier) == expected
+
+
[email protected]('val, op, expected', [
+    ('1.3', '>=', '<=1.3'),
+    ('1.3', '>', '<1.3'),
+    ('1.3', '==', '==1.3'),
+    ('1.3', '===', '===1.3'),
+])
+def test_swap(op, val, expected):
+    m = VersionMarker(
+        lhs=Value(val),
+        op=Op(op),
+        rhs=Variable('python_version'),
+    )
+    assert str(m.specifier) == expected
+
+
[email protected]('left_op, left_val, right_op, right_val, result', [
+    ('<', '1.2',    '<', '1.4',     '<1.2'),
+    ('<=', '1.2',   '<', '1.4',     '<=1.2'),
+    ('==', '1.2',   '<', '1.4',     '==1.2'),
+    ('>=', '1.2',   '<=', '1.2',    '==1.2'),
+
+    ('<=', '1.2',   '>=', '1.4',    None),
+    ('<', '1.2',    '>', '1.2',     None),
+])
+def test_merge(left_op, left_val, right_op, right_val, result):
+    lm = VersionMarker(
+        lhs=Variable('python_version'),
+        op=Op(left_op),
+        rhs=Value(left_val),
+    )
+    rm = VersionMarker(
+        lhs=Variable('python_version'),
+        op=Op(right_op),
+        rhs=Value(right_val),
+    )
+    if result is None:
+        with pytest.raises(TypeError):
+            lm + rm
+    else:
+        merged = lm + rm
+        assert str(merged.specifier) == result


Reply via email to