Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-ddt for openSUSE:Factory 
checked in at 2022-09-27 20:13:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-ddt (Old)
 and      /work/SRC/openSUSE:Factory/.python-ddt.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-ddt"

Tue Sep 27 20:13:14 2022 rev:17 rq:1006090 version:1.6.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-ddt/python-ddt.changes    2021-11-10 
21:45:55.479797764 +0100
+++ /work/SRC/openSUSE:Factory/.python-ddt.new.2275/python-ddt.changes  
2022-09-27 20:13:17.465742381 +0200
@@ -1,0 +2,10 @@
+Mon Sep 26 10:38:04 UTC 2022 - Dirk M??ller <dmuel...@suse.com>
+
+- update to 1.6.0:
+  * Moved @named_data into main ddt.py module so it can be imported
+  * Enable usage of Sequence in named_data.py
+  * @named_data decorator to give tests with @DaTa custom names
+  * End support for 3.5
+  * Add new Python versions support
+
+-------------------------------------------------------------------

Old:
----
  ddt-1.4.4.tar.gz

New:
----
  ddt-1.6.0.tar.gz

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

Other differences:
------------------
++++++ python-ddt.spec ++++++
--- /var/tmp/diff_new_pack.d9BNFI/_old  2022-09-27 20:13:18.009743581 +0200
+++ /var/tmp/diff_new_pack.d9BNFI/_new  2022-09-27 20:13:18.013743589 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-ddt
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %bcond_without python2
 Name:           python-ddt
-Version:        1.4.4
+Version:        1.6.0
 Release:        0
 Summary:        Data-Driven/Decorated Tests
 License:        MIT

++++++ ddt-1.4.4.tar.gz -> ddt-1.6.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ddt-1.4.4/PKG-INFO new/ddt-1.6.0/PKG-INFO
--- old/ddt-1.4.4/PKG-INFO      2021-10-05 00:43:33.093427700 +0200
+++ new/ddt-1.6.0/PKG-INFO      2022-08-10 18:45:43.834721600 +0200
@@ -1,12 +1,10 @@
 Metadata-Version: 2.1
 Name: ddt
-Version: 1.4.4
+Version: 1.6.0
 Summary: Data-Driven/Decorated Tests
 Home-page: https://github.com/datadriventests/ddt
 Author: Carles Barrob??s
 Author-email: car...@barrobes.com
-License: UNKNOWN
-Platform: UNKNOWN
 Classifier: Development Status :: 4 - Beta
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: MIT License
@@ -15,9 +13,12 @@
 Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
 Classifier: Topic :: Software Development :: Testing
 License-File: LICENSE.md
 
 A library to multiply test cases
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ddt-1.4.4/ddt.egg-info/PKG-INFO 
new/ddt-1.6.0/ddt.egg-info/PKG-INFO
--- old/ddt-1.4.4/ddt.egg-info/PKG-INFO 2021-10-05 00:43:32.000000000 +0200
+++ new/ddt-1.6.0/ddt.egg-info/PKG-INFO 2022-08-10 18:45:43.000000000 +0200
@@ -1,12 +1,10 @@
 Metadata-Version: 2.1
 Name: ddt
-Version: 1.4.4
+Version: 1.6.0
 Summary: Data-Driven/Decorated Tests
 Home-page: https://github.com/datadriventests/ddt
 Author: Carles Barrob??s
 Author-email: car...@barrobes.com
-License: UNKNOWN
-Platform: UNKNOWN
 Classifier: Development Status :: 4 - Beta
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: MIT License
@@ -15,9 +13,12 @@
 Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
 Classifier: Topic :: Software Development :: Testing
 License-File: LICENSE.md
 
 A library to multiply test cases
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ddt-1.4.4/ddt.egg-info/SOURCES.txt 
new/ddt-1.6.0/ddt.egg-info/SOURCES.txt
--- old/ddt-1.4.4/ddt.egg-info/SOURCES.txt      2021-10-05 00:43:32.000000000 
+0200
+++ new/ddt-1.6.0/ddt.egg-info/SOURCES.txt      2022-08-10 18:45:43.000000000 
+0200
@@ -14,6 +14,7 @@
 test/mycode.py
 test/test_example.py
 test/test_functional.py
+test/test_named_data.py
 test/data/test_custom_yaml_loader.yaml
 test/data/test_data_dict.json
 test/data/test_data_dict.yaml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ddt-1.4.4/ddt.py new/ddt-1.6.0/ddt.py
--- old/ddt-1.4.4/ddt.py        2021-10-05 00:43:21.000000000 +0200
+++ new/ddt-1.6.0/ddt.py        2022-08-10 18:45:24.000000000 +0200
@@ -20,7 +20,14 @@
 else:
     _have_yaml = True
 
-__version__ = '1.4.4'
+try:
+    # Python >=3
+    from collections.abc import Sequence
+except ImportError:
+    # Python 2.7
+    from collections import Sequence
+
+__version__ = '1.6.0'
 
 # These attributes will not conflict with any real python attribute
 # They are added to the decorated test method and processed later
@@ -33,10 +40,32 @@
 INDEX_LEN = '%index_len'           # store the index length of the data
 
 
+# These are helper classes for @named_data that allow ddt tests to have 
meaningful names.
+class _NamedDataList(list):
+    def __init__(self, name, *args):
+        super(_NamedDataList, self).__init__(args)
+        self.name = name
+
+    def __str__(self):
+        return str(self.name)
+
+
+class _NamedDataDict(dict):
+    def __init__(self, **kwargs):
+        if "name" not in kwargs.keys():
+            raise KeyError("@named_data expects a dictionary with a 'name' 
key.")
+        self.name = kwargs.pop('name')
+        super(_NamedDataDict, self).__init__(kwargs)
+
+    def __str__(self):
+        return str(self.name)
+
+
+trivial_types = (type(None), bool, int, float, _NamedDataList, _NamedDataDict)
 try:
-    trivial_types = (type(None), bool, int, float, basestring)
+    trivial_types += (basestring, )
 except NameError:
-    trivial_types = (type(None), bool, int, float, str)
+    trivial_types += (str, )
 
 
 @unique
@@ -382,3 +411,57 @@
     # ``arg`` is the unittest's test class when decorating with ``@ddt`` while
     # it is ``None`` when decorating a test class with ``@ddt(k=v)``.
     return wrapper(arg) if inspect.isclass(arg) else wrapper
+
+
+def named_data(*named_values):
+    """
+    This decorator is to allow for meaningful names to be given to tests that 
would otherwise use @ddt.data and
+    @ddt.unpack.
+
+    Example of original ddt usage:
+        @ddt.ddt
+        class TestExample(TemplateTest):
+            @ddt.data(
+                [0, 1],
+                [10, 11]
+            )
+            @ddt.unpack
+            def test_values(self, value1, value2):
+                ...
+
+    Example of new usage:
+        @ddt.ddt
+        class TestExample(TemplateTest):
+            @named_data(
+                ['LabelA', 0, 1],
+                ['LabelB', 10, 11],
+            )
+            def test_values(self, value1, value2):
+                ...
+
+    Note that @unpack is not used.
+
+    :param Sequence[Any] | dict[Any,Any] named_values: Each named_value should 
be a Sequence (e.g. list or tuple) with
+        the name as the first element, or a dictionary with 'name' as one of 
the keys. The name will be coerced to a
+        string and all other values will be passed unchanged to the test.
+    """
+    values = []
+    for named_value in named_values:
+        if not isinstance(named_value, (Sequence, dict)):
+            raise TypeError(
+                "@named_data expects a Sequence (list, tuple) or dictionary, 
and not '{}'.".format(type(named_value))
+            )
+
+        value = _NamedDataDict(**named_value) if isinstance(named_value, dict) 
\
+            else _NamedDataList(named_value[0], *named_value[1:])
+
+        # Remove the __doc__ attribute so @ddt.data doesn't add the NamedData 
class docstrings to the test name.
+        value.__doc__ = None
+
+        values.append(value)
+
+    def wrapper(func):
+        data(*values)(unpack(func))
+        return func
+
+    return wrapper
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ddt-1.4.4/setup.py new/ddt-1.6.0/setup.py
--- old/ddt-1.4.4/setup.py      2021-10-05 00:43:21.000000000 +0200
+++ new/ddt-1.6.0/setup.py      2022-08-10 18:45:24.000000000 +0200
@@ -22,7 +22,11 @@
         'Programming Language :: Python :: 2',
         'Programming Language :: Python :: 2.7',
         'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.5',
+        'Programming Language :: Python :: 3.6',
+        'Programming Language :: Python :: 3.7',
+        'Programming Language :: Python :: 3.8',
+        'Programming Language :: Python :: 3.9',
+        'Programming Language :: Python :: 3.10',
         'Topic :: Software Development :: Testing',
     ],
     setup_requires=['enum34; python_version < "3"'],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ddt-1.4.4/test/test_named_data.py 
new/ddt-1.6.0/test/test_named_data.py
--- old/ddt-1.4.4/test/test_named_data.py       1970-01-01 01:00:00.000000000 
+0100
+++ new/ddt-1.6.0/test/test_named_data.py       2022-08-10 18:45:24.000000000 
+0200
@@ -0,0 +1,66 @@
+import ddt
+import unittest
+
+
+@ddt.ddt
+class TestNamedData(unittest.TestCase):
+    class NonTrivialClass(object):
+        pass
+
+    @ddt.named_data(
+        ['Single', 0, 1]
+    )
+    def test_single_named_value(self, value1, value2):
+        self.assertGreater(value2, value1)
+
+    @ddt.named_data(
+        ['1st', 1, 2],
+        ('2nd', 3, 4)
+    )
+    def test_multiple_named_value_seqs(self, value1, value2):
+        self.assertGreater(value2, value1)
+
+    @ddt.named_data(
+        dict(name='1st', value2=1, value1=0),
+        {'name': '2nd', 'value2': 1, 'value1': 0}
+    )
+    def test_multiple_named_value_dicts(self, value1, value2):
+        self.assertGreater(value2, value1)
+
+    @ddt.named_data(
+        dict(name='1st', value2=1, value1=0),
+        ('2nd', 0, 1)
+    )
+    def test_multiple_named_value_mixed(self, value1, value2):
+        self.assertGreater(value2, value1)
+
+    @ddt.named_data(
+        ['Passes', NonTrivialClass(), True],
+        ('Fails', 1, False)
+    )
+    def test_seq_with_nontrivial_type(self, value, passes):
+        if passes:
+            self.assertIsInstance(value, self.NonTrivialClass)
+        else:
+            self.assertNotIsInstance(value, self.NonTrivialClass)
+
+    @ddt.named_data(
+        {'name': 'Passes', 'value': NonTrivialClass(), 'passes': True},
+        {'name': 'Fails', 'value': 1, 'passes': False}
+    )
+    def test_dict_with_nontrivial_type(self, value, passes):
+        if passes:
+            self.assertIsInstance(value, self.NonTrivialClass)
+        else:
+            self.assertNotIsInstance(value, self.NonTrivialClass)
+
+    def test_missing_name_dict(self):
+        with self.assertRaises(KeyError):
+            @ddt.named_data(
+                {'not_a_name': 'oops', 'value': 1}
+            )
+            def _internal_test(value):
+                pass
+
+
+

Reply via email to