forked from pool/python-datadiff
Accepting request 1114962 from home:pgajdos:python
- Update to version 2.2.0: * Bump version * Removed separate version file now that Setuptools can read without importing. * Ran ruff --fix to clean up some lint. * Remove LICENSE from MANIFEST.in (Setuptools includes it by default now). * Add a pyproject.toml for better packaging support. * Mark failing tests as xfail until someone can investigate. * Moved package metadata to declarative setup.cfg * Remove tests_require * Remove superfluous license field * Remove commented code for deprecated usage. * Port test runner to nose. - added patches https://sourceforge.net/p/datadiff/code/merge-requests/3/ + python-datadiff-no-six.patch OBS-URL: https://build.opensuse.org/request/show/1114962 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-datadiff?expand=0&rev=6
This commit is contained in:
202
LICENSE-2.0.txt
202
LICENSE-2.0.txt
@@ -1,202 +0,0 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
4
_service
4
_service
@@ -2,11 +2,11 @@
|
||||
<service mode="disabled" name="tar_scm">
|
||||
<param name="url">https://git.code.sf.net/p/datadiff/code</param>
|
||||
<param name="scm">git</param>
|
||||
<param name="revision">8ee0ad3</param>
|
||||
<param name="revision">284606</param>
|
||||
<param name="package-meta">no</param>
|
||||
<param name="changesgenerate">enable</param>
|
||||
<param name="filename">datadiff</param>
|
||||
<param name="versionformat">2.1.0</param>
|
||||
<param name="versionformat">2.2.0</param>
|
||||
</service>
|
||||
<service mode="disabled" name="recompress">
|
||||
<param name="file">*.tar</param>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<servicedata>
|
||||
<service name="tar_scm">
|
||||
<param name="url">https://git.code.sf.net/p/datadiff/code</param>
|
||||
<param name="changesrevision">8ee0ad35cac2df636c04fdb55c4f81d1b3260430</param></service></servicedata>
|
||||
<param name="changesrevision">284606f7237ba0c73ddf6c305d8c4c5a8205fc1f</param></service></servicedata>
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e497fa882a0cfc0e53e19490efc6d25605f2b4465b1be63fe105b7a704344a2e
|
||||
size 10988
|
||||
3
datadiff-2.2.0.tar.xz
Normal file
3
datadiff-2.2.0.tar.xz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5a5a7cd7293d274fd66950d69939274e32580932ec544e07da5b7e921a2dc5ae
|
||||
size 10980
|
||||
46
python-datadiff-no-six.patch
Normal file
46
python-datadiff-no-six.patch
Normal file
@@ -0,0 +1,46 @@
|
||||
diff --git a/datadiff/tests/test_datadiff.py b/datadiff/tests/test_datadiff.py
|
||||
index 83f39e6..f30b340 100644
|
||||
--- a/datadiff/tests/test_datadiff.py
|
||||
+++ b/datadiff/tests/test_datadiff.py
|
||||
@@ -5,7 +5,6 @@ from datetime import datetime
|
||||
from unittest.case import SkipTest
|
||||
|
||||
import pytest
|
||||
-import six
|
||||
|
||||
from datadiff import diff, DataDiff, NotHashable, DiffNotImplementedForType, DiffTypeError
|
||||
|
||||
@@ -43,20 +42,6 @@ def test_diff_multiline_strings():
|
||||
assert str(d) == expected
|
||||
|
||||
|
||||
-def test_diff_unicode_vs_str():
|
||||
- if six.PY3:
|
||||
- raise SkipTest("Unicode and bytes are different types")
|
||||
- d = diff(u'abc\ndef\nghi', b'abc\nghi', fromfile="x", tofile="y")
|
||||
- expected = dedent('''\
|
||||
- --- x
|
||||
- +++ y
|
||||
- @@ -1,3 +1,2 @@
|
||||
- abc
|
||||
- -def
|
||||
- ghi''')
|
||||
- assert str(d) == expected
|
||||
-
|
||||
-
|
||||
def test_diff_list():
|
||||
a = [1, 'xyz', 2, 3, 4, 5]
|
||||
b = [1, 'abc', 2, 4, 6]
|
||||
diff --git a/tox.ini b/tox.ini
|
||||
index b9d77fc..b9c446a 100644
|
||||
--- a/tox.ini
|
||||
+++ b/tox.ini
|
||||
@@ -6,7 +6,6 @@ setenv = PYTHONHASHSEED=0
|
||||
deps =
|
||||
coverage
|
||||
pytest
|
||||
- six
|
||||
commands = coverage run --source=datadiff --branch --parallel-mode {envbindir}/pytest
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Oct 03 08:04:27 UTC 2023 - pgajdos@suse.com
|
||||
|
||||
- Update to version 2.2.0:
|
||||
* Bump version
|
||||
* Removed separate version file now that Setuptools can read without importing.
|
||||
* Ran ruff --fix to clean up some lint.
|
||||
* Remove LICENSE from MANIFEST.in (Setuptools includes it by default now).
|
||||
* Add a pyproject.toml for better packaging support.
|
||||
* Mark failing tests as xfail until someone can investigate.
|
||||
* Moved package metadata to declarative setup.cfg
|
||||
* Remove tests_require
|
||||
* Remove superfluous license field
|
||||
* Remove commented code for deprecated usage.
|
||||
* Port test runner to nose.
|
||||
- added patches
|
||||
https://sourceforge.net/p/datadiff/code/merge-requests/3/
|
||||
+ python-datadiff-no-six.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 22 06:43:10 UTC 2023 - daniel.garcia@suse.com
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
|
||||
Name: python-datadiff
|
||||
Version: 2.1.0
|
||||
Version: 2.2.0
|
||||
Release: 0
|
||||
Summary: DataDiff is a library to provide human-readable diffs of python data structures
|
||||
License: Apache-2.0
|
||||
@@ -26,8 +26,8 @@ URL: https://sourceforge.net/projects/datadiff/
|
||||
#Source: https://files.pythonhosted.org/packages/source/d/datadiff/datadiff-%%{version}.tar.gz
|
||||
#Git-Clone: https://git.code.sf.net/p/datadiff/code
|
||||
Source: datadiff-%{version}.tar.xz
|
||||
Source1: https://www.apache.org/licenses/LICENSE-2.0.txt
|
||||
Patch0: switch-to-pytest.patch
|
||||
# https://sourceforge.net/p/datadiff/code/merge-requests/3/
|
||||
Patch0: python-datadiff-no-six.patch
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
@@ -48,7 +48,6 @@ a nice data diff is shown, letting you easily pinpoint the root difference.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n datadiff-%{version}
|
||||
cp %{SOURCE1} .
|
||||
|
||||
%build
|
||||
%python_build
|
||||
@@ -58,11 +57,10 @@ cp %{SOURCE1} .
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
# Broken tests with py311
|
||||
%pytest -k "not (test_diff_set or test_diff_frozenset)"
|
||||
%pytest
|
||||
|
||||
%files %{python_files}
|
||||
%license LICENSE-2.0.txt
|
||||
%license LICENSE
|
||||
%{python_sitelib}/datadiff
|
||||
%{python_sitelib}/datadiff-%{version}*-info
|
||||
|
||||
|
||||
@@ -1,390 +0,0 @@
|
||||
Index: datadiff-2.2.0/datadiff/tests/test_datadiff.py
|
||||
===================================================================
|
||||
--- datadiff-2.2.0.orig/datadiff/tests/test_datadiff.py
|
||||
+++ datadiff-2.2.0/datadiff/tests/test_datadiff.py
|
||||
@@ -4,8 +4,7 @@ from textwrap import dedent
|
||||
from datetime import datetime
|
||||
from unittest.case import SkipTest
|
||||
|
||||
-import six
|
||||
-from nose.tools import assert_raises, assert_equal, assert_false, raises
|
||||
+from pytest import raises
|
||||
|
||||
from datadiff import diff, DataDiff, NotHashable, DiffNotImplementedForType, DiffTypeError
|
||||
|
||||
@@ -19,16 +18,17 @@ class Foo(object):
|
||||
|
||||
|
||||
def test_diff_objects():
|
||||
- with assert_raises(DiffNotImplementedForType) as raised:
|
||||
+ with raises(DiffNotImplementedForType) as raised:
|
||||
diff(Foo(), Foo(), fromfile="x", tofile="y")
|
||||
- assert_equal(raised.exception.attempted_type, Foo)
|
||||
- assert_equal(str(raised.exception), "diff() not implemented for <class 'datadiff.tests.test_datadiff.Foo'>")
|
||||
+ assert raised.value.attempted_type is Foo
|
||||
+ assert type(raised.value) is DiffNotImplementedForType
|
||||
|
||||
|
||||
def test_diff_oneline_strings():
|
||||
- with assert_raises(DiffNotImplementedForType) as raised:
|
||||
+ with raises(DiffNotImplementedForType) as raised:
|
||||
diff('foobar', 'baz', fromfile="x", tofile="y")
|
||||
- assert_equal(raised.exception.attempted_type, str)
|
||||
+ assert type(raised.value) is DiffNotImplementedForType
|
||||
+ assert raised.value.attempted_type is str
|
||||
|
||||
|
||||
def test_diff_multiline_strings():
|
||||
@@ -40,12 +40,11 @@ def test_diff_multiline_strings():
|
||||
abc
|
||||
-def
|
||||
ghi''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_diff_unicode_vs_str():
|
||||
- if six.PY3:
|
||||
- raise SkipTest("Unicode and bytes are different types")
|
||||
+ raise SkipTest("Unicode and bytes are different types")
|
||||
d = diff(u'abc\ndef\nghi', b'abc\nghi', fromfile="x", tofile="y")
|
||||
expected = dedent('''\
|
||||
--- x
|
||||
@@ -54,7 +53,7 @@ def test_diff_unicode_vs_str():
|
||||
abc
|
||||
-def
|
||||
ghi''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_diff_list():
|
||||
@@ -75,7 +74,7 @@ def test_diff_list():
|
||||
-5,
|
||||
+6,
|
||||
]''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_diff_list_context():
|
||||
@@ -104,7 +103,7 @@ def test_diff_list_context():
|
||||
1,
|
||||
@@ @@
|
||||
]''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_diff_list_2nd_longer():
|
||||
@@ -120,7 +119,7 @@ def test_diff_list_2nd_longer():
|
||||
+4,
|
||||
+5,
|
||||
]''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_diff_list_list():
|
||||
@@ -136,7 +135,7 @@ def test_diff_list_list():
|
||||
-[2, 3],
|
||||
4,
|
||||
]''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_diff_list_dict():
|
||||
@@ -152,7 +151,7 @@ def test_diff_list_dict():
|
||||
-{'a': 'b'},
|
||||
4,
|
||||
]''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_diff_list_set():
|
||||
@@ -168,7 +167,7 @@ def test_diff_list_set():
|
||||
-%s8, 9%s,
|
||||
4,
|
||||
]''') % (set_start, set_end)
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_diff_seq_objects():
|
||||
@@ -194,7 +193,7 @@ def test_diff_seq_objects():
|
||||
1,
|
||||
+2,
|
||||
])''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_diff_almost_seq_objects():
|
||||
@@ -205,7 +204,7 @@ def test_diff_almost_seq_objects():
|
||||
def __iter__(self):
|
||||
return iter(self.list)
|
||||
|
||||
- assert_raises(DiffTypeError, diff, FooSeq([1]), FooSeq([1, 2]))
|
||||
+ raises(DiffTypeError, diff, FooSeq([1]), FooSeq([1, 2]))
|
||||
|
||||
|
||||
def test_tuple():
|
||||
@@ -219,7 +218,7 @@ def test_tuple():
|
||||
-2,
|
||||
+3,
|
||||
)''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_diff_dict():
|
||||
@@ -248,7 +247,7 @@ def test_diff_dict():
|
||||
assert "-'zero': 0," in diff_str
|
||||
assert "+'zero': '@'," in diff_str
|
||||
context_pattern = r"^ '\w+': \d+,$"
|
||||
- assert_equal(_count_lines(context_pattern, diff_str), 3)
|
||||
+ assert _count_lines(context_pattern, diff_str) == 3
|
||||
|
||||
|
||||
def _count_lines(pattern, string):
|
||||
@@ -273,7 +272,7 @@ def test_diff_dict_keytypes():
|
||||
+2: 2,
|
||||
+datetime.datetime(2010, 10, 28, 0, 0): 1,
|
||||
}''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_diff_dict_complex():
|
||||
@@ -287,7 +286,7 @@ def test_diff_dict_complex():
|
||||
'a': 1,
|
||||
-'b': {'foo': 'bar'},
|
||||
}''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_diff_dict_similar_nested():
|
||||
@@ -301,7 +300,7 @@ def test_diff_dict_similar_nested():
|
||||
-'a': [1, 2],
|
||||
+'a': (1, 2),
|
||||
}''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_diff_set(set_type=set):
|
||||
@@ -320,7 +319,7 @@ def test_diff_set(set_type=set):
|
||||
'abc',
|
||||
7,
|
||||
])''') % set_type.__name__
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_diff_set_context():
|
||||
@@ -337,7 +336,7 @@ def test_diff_set_context():
|
||||
3,
|
||||
@@ @@
|
||||
])''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_diff_frozenset():
|
||||
@@ -345,52 +344,50 @@ def test_diff_frozenset():
|
||||
|
||||
|
||||
def test_equal_set():
|
||||
- assert_false(diff(set([1]), set([1])))
|
||||
+ assert not diff(set([1]), set([1]))
|
||||
|
||||
|
||||
def test_empty_set():
|
||||
- assert_false(diff(set([]), set([])))
|
||||
+ assert not diff(set([]), set([]))
|
||||
|
||||
|
||||
def test_eval_bool():
|
||||
d = diff([1], [1], fromfile="x", tofile="y")
|
||||
- assert_equal(bool(d), False)
|
||||
+ assert bool(d) == False
|
||||
|
||||
d = diff([1], [2], fromfile="x", tofile="y")
|
||||
- assert_equal(bool(d), True)
|
||||
+ assert bool(d) == True
|
||||
|
||||
d = diff(dict(a=1), dict(a=1), fromfile="x", tofile="y")
|
||||
- assert_equal(bool(d), False)
|
||||
+ assert bool(d) == False
|
||||
|
||||
d = diff(dict(a=1, b=2, c=3, d=4), dict(a=1, b=2, c=3, d=4), fromfile="x", tofile="y")
|
||||
- assert_equal(bool(d), False)
|
||||
+ assert bool(d) == False
|
||||
|
||||
|
||||
def test_equal():
|
||||
d = diff([1], [1], fromfile="x", tofile="y")
|
||||
- assert_equal(str(d), '')
|
||||
+ assert str(d) == ''
|
||||
|
||||
|
||||
-@raises(DiffTypeError)
|
||||
def test_diff_types():
|
||||
- d = diff([1], {1: 1}, fromfile="x", tofile="y")
|
||||
+ raises(DiffTypeError, diff, [1], {1: 1}, fromfile="x", tofile="y")
|
||||
|
||||
|
||||
-@raises(Exception)
|
||||
def test_DataDiff_init_params():
|
||||
- DataDiff(list, '[')
|
||||
+ raises(Exception, DataDiff, list, '[')
|
||||
|
||||
|
||||
def test_DataDiff_change_type():
|
||||
dd = DataDiff(list, '[', ']')
|
||||
dd.multi('foobar', [1234])
|
||||
- assert_raises(Exception, str, dd)
|
||||
+ raises(Exception, str, dd)
|
||||
|
||||
|
||||
def test_unhashable_type():
|
||||
a = []
|
||||
b = [slice(1)]
|
||||
- assert_raises(NotHashable, diff, a, b)
|
||||
+ raises(NotHashable, diff, a, b)
|
||||
|
||||
|
||||
def test_recursive_list():
|
||||
@@ -413,7 +410,7 @@ def test_recursive_list():
|
||||
],
|
||||
3,
|
||||
]''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_recursive_tuple_different_types():
|
||||
@@ -437,7 +434,7 @@ def test_recursive_tuple_different_types
|
||||
),
|
||||
3,
|
||||
)''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_recursive_dict():
|
||||
@@ -455,7 +452,7 @@ def test_recursive_dict():
|
||||
},
|
||||
'c': 3,
|
||||
}''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_recursive_set():
|
||||
@@ -473,7 +470,7 @@ def test_recursive_set():
|
||||
2,
|
||||
])''' % (frozenset_start, frozenset_end,
|
||||
frozenset_start, frozenset_end))
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_nested_unhashable():
|
||||
@@ -496,7 +493,7 @@ def test_nested_unhashable():
|
||||
},
|
||||
),
|
||||
]''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
|
||||
|
||||
def test_nested_unhashable2():
|
||||
@@ -517,4 +514,4 @@ def test_nested_unhashable2():
|
||||
},
|
||||
},
|
||||
]''')
|
||||
- assert_equal(str(d), expected)
|
||||
+ assert str(d) == expected
|
||||
Index: datadiff-2.2.0/datadiff/tests/test_datadiff_tools.py
|
||||
===================================================================
|
||||
--- datadiff-2.2.0.orig/datadiff/tests/test_datadiff_tools.py
|
||||
+++ datadiff-2.2.0/datadiff/tests/test_datadiff_tools.py
|
||||
@@ -2,20 +2,19 @@ import sys
|
||||
from textwrap import dedent
|
||||
|
||||
from datadiff import tools
|
||||
-from datadiff.tests.test_datadiff import assert_equal
|
||||
|
||||
-from nose.tools import assert_raises
|
||||
+from pytest import raises
|
||||
|
||||
|
||||
def test_assert_equal_true():
|
||||
# nothing raised
|
||||
- assert_equal(None, tools.assert_equals(7, 7))
|
||||
+ assert tools.assert_equals(7, 7) is None
|
||||
|
||||
|
||||
def test_assert_equal_false():
|
||||
- with assert_raises(AssertionError) as raised:
|
||||
+ with raises(AssertionError) as raised:
|
||||
tools.assert_equals([3, 4], [5, 6])
|
||||
- assert_equal(str(raised.exception), dedent('''\
|
||||
+ assert str(raised.value) == dedent('''\
|
||||
|
||||
--- a
|
||||
+++ b
|
||||
@@ -25,29 +24,29 @@ def test_assert_equal_false():
|
||||
-4,
|
||||
+5,
|
||||
+6,
|
||||
- ]'''))
|
||||
+ ]''')
|
||||
|
||||
|
||||
def test_assert_equal_msg():
|
||||
- with assert_raises(AssertionError) as raised:
|
||||
+ with raises(AssertionError) as raised:
|
||||
tools.assert_equals(3, 4, "whoops")
|
||||
- assert_equal(str(raised.exception), "whoops")
|
||||
+ assert str(raised.value) == "whoops"
|
||||
|
||||
|
||||
def test_assert_equals():
|
||||
- assert_equal(tools.assert_equal, tools.assert_equals)
|
||||
+ assert tools.assert_equal == tools.assert_equals
|
||||
|
||||
|
||||
def test_assert_equal_simple():
|
||||
- with assert_raises(AssertionError) as raised:
|
||||
+ with raises(AssertionError) as raised:
|
||||
tools.assert_equals(True, False)
|
||||
- assert_equal(str(raised.exception), 'True != False')
|
||||
+ assert str(raised.value) == 'True != False'
|
||||
|
||||
|
||||
def test_assert_equal_simple_types():
|
||||
- with assert_raises(AssertionError) as raised:
|
||||
+ with raises(AssertionError) as raised:
|
||||
tools.assert_equals('a', 7)
|
||||
- assert_equal(str(raised.exception), dedent("'a' != 7"))
|
||||
+ assert str(raised.value) == dedent("'a' != 7")
|
||||
|
||||
|
||||
def test_assert_almost_equal():
|
||||
@@ -59,7 +58,7 @@ def test_assert_almost_equal():
|
||||
|
||||
|
||||
def test_assert_not_almost_equal():
|
||||
- assert_raises(AssertionError, tools.assertAlmostEqual, [1.0], [1.00001])
|
||||
- assert_raises(AssertionError, tools.assertAlmostEqual, [1.0], [1.0001], places=4)
|
||||
- assert_raises(AssertionError, tools.assertAlmostEqual, {"k": 1.0}, {"k": 1.1}, places=4)
|
||||
- assert_raises(AssertionError, tools.assertAlmostEqual, {1.0}, {1.1}, places=4)
|
||||
+ raises(AssertionError, tools.assertAlmostEqual, [1.0], [1.00001])
|
||||
+ raises(AssertionError, tools.assertAlmostEqual, [1.0], [1.0001], places=4)
|
||||
+ raises(AssertionError, tools.assertAlmostEqual, {"k": 1.0}, {"k": 1.1}, places=4)
|
||||
+ raises(AssertionError, tools.assertAlmostEqual, {1.0}, {1.1}, places=4)
|
||||
Reference in New Issue
Block a user