DataDiff
========
DataDiff is a library to provide human-readable diffs of python data structures.
It can handle sequence types (lists, tuples, etc), sets, and dictionaries.
Dictionaries and sequences will be diffed recursively, when applicable.
It has special-case handling for multi-line strings, showing them as a typical unified diff.
Drop-in replacements for some nose assertions are available. If the assertion fails,
a nice data diff is shown, letting you easily pinpoint the root difference.
``datadiff`` works on Python 2.6 through Python 3.
DataDiff project homepage: http://sourceforge.net/projects/datadiff/
Example
-------
Here's an example::
>>> from datadiff import diff
>>> a = dict(foo=1, bar=2, baz=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
>>> b = dict(foo=1, bar=4, baz=[0, 1, 2, 3, 4, 5, 6, 7, 8])
>>> print diff(a, b)
--- a
+++ b
{
-'bar': 2,
+'bar': 4,
'baz': [
@@ -5,11 +5,8 @@
6,
7,
8,
-9,
-10,
-11,
],
'foo': 1,
}
>>>
>>> from datadiff.tools import assert_equal
>>> assert_equal([1, 2, 3], [1, 2, 5])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "datadiff/tools.py", line 29, in assert_equal
raise AssertionError(msg)
AssertionError:
--- a
+++ b
[
@@ -0,2 +0,2 @@
1,
2,
-3,
+5,
]
License
-------
Copyright Dave Brondsema
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.
Raw data
{
"_id": null,
"home_page": "http://sourceforge.net/projects/datadiff/",
"name": "datadiff",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "data,diff",
"author": "Dave Brondsema",
"author_email": "dave@brondsema.net",
"download_url": "https://files.pythonhosted.org/packages/59/cd/c1db34803f8093ad9d3621b0bf778a12bbd8c11f540a5fbd14f325f0f6b6/datadiff-2.2.0.tar.gz",
"platform": null,
"description": "DataDiff\n========\n\nDataDiff is a library to provide human-readable diffs of python data structures.\nIt can handle sequence types (lists, tuples, etc), sets, and dictionaries.\n\nDictionaries and sequences will be diffed recursively, when applicable.\n\nIt has special-case handling for multi-line strings, showing them as a typical unified diff.\n\nDrop-in replacements for some nose assertions are available. If the assertion fails,\na nice data diff is shown, letting you easily pinpoint the root difference.\n\n``datadiff`` works on Python 2.6 through Python 3.\n\nDataDiff project homepage: http://sourceforge.net/projects/datadiff/\n\nExample\n-------\n\nHere's an example::\n\n >>> from datadiff import diff\n >>> a = dict(foo=1, bar=2, baz=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])\n >>> b = dict(foo=1, bar=4, baz=[0, 1, 2, 3, 4, 5, 6, 7, 8])\n >>> print diff(a, b)\n --- a\n +++ b\n {\n -'bar': 2,\n +'bar': 4,\n 'baz': [\n @@ -5,11 +5,8 @@\n 6,\n 7,\n 8,\n -9,\n -10,\n -11,\n ],\n 'foo': 1,\n }\n >>>\n >>> from datadiff.tools import assert_equal\n >>> assert_equal([1, 2, 3], [1, 2, 5])\n Traceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\n File \"datadiff/tools.py\", line 29, in assert_equal\n raise AssertionError(msg)\n AssertionError:\n --- a\n +++ b\n [\n @@ -0,2 +0,2 @@\n 1,\n 2,\n -3,\n +5,\n ]\n\nLicense\n-------\n\nCopyright Dave Brondsema\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
"bugtrack_url": null,
"license": "",
"summary": "DataDiff is a library to provide human-readable diffs of python data structures.",
"version": "2.2.0",
"project_urls": {
"Homepage": "http://sourceforge.net/projects/datadiff/"
},
"split_keywords": [
"data",
"diff"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "df83479aca48c269f6224db0c34e389a437d480ffe4ed48b909347ec301cc61a",
"md5": "93cb998ee1300df9daafd5b60ad79fc3",
"sha256": "4e63e4abe3955a77c631eaf94aa86836040ea1648d8a06c600b5e75c48d486c6"
},
"downloads": -1,
"filename": "datadiff-2.2.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "93cb998ee1300df9daafd5b60ad79fc3",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 14050,
"upload_time": "2023-08-27T16:11:48",
"upload_time_iso_8601": "2023-08-27T16:11:48.315855Z",
"url": "https://files.pythonhosted.org/packages/df/83/479aca48c269f6224db0c34e389a437d480ffe4ed48b909347ec301cc61a/datadiff-2.2.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "59cdc1db34803f8093ad9d3621b0bf778a12bbd8c11f540a5fbd14f325f0f6b6",
"md5": "bd209813a39b88056cb0b41cc765e958",
"sha256": "7ce70dfeea8c33f1d88db46b0effee905cc36b4db739f6bb070a82de8981d30b"
},
"downloads": -1,
"filename": "datadiff-2.2.0.tar.gz",
"has_sig": false,
"md5_digest": "bd209813a39b88056cb0b41cc765e958",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13468,
"upload_time": "2023-08-27T16:11:49",
"upload_time_iso_8601": "2023-08-27T16:11:49.400392Z",
"url": "https://files.pythonhosted.org/packages/59/cd/c1db34803f8093ad9d3621b0bf778a12bbd8c11f540a5fbd14f325f0f6b6/datadiff-2.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-27 16:11:49",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "datadiff"
}