[issue34514] assertEqual doesn't use maxDiff when comparing dictionaries

2020-10-20 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34514] assertEqual doesn't use maxDiff when comparing dictionaries

2020-09-17 Thread Irit Katriel


Irit Katriel  added the comment:

I think this can be closed as not a bug, unless Victor can clarify with an 
example script why there is an issue.

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34514] assertEqual doesn't use maxDiff when comparing dictionaries

2018-08-27 Thread Prudvi RajKumar Maddala


Prudvi RajKumar Maddala  added the comment:

I see that maxDiff is applied correctly when comparing dictionaries. I don't 
think that's an issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34514] assertEqual doesn't use maxDiff when comparing dictionaries

2018-08-27 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

@victor I am little confused over the issue since you have said 
"`assertDictEqual()` "will be used by default to compare dictionaries in calls 
to assertEqual()" and "`maxDiff` doesn't apply to `assertEqual()` when 
comparing dictionaries" . Since assertDictEqual is used for assertEqual calls 
when they compare dictionaries I can see that maxDiff value is applied to the 
diffs. A script will be helpful here on the expected and actual output. The 
attached script I have used to check that the maxDiff value is applied.


$ ./python.exe ../backups/bpo34514.py


==
FAIL: test_assert_dict_equal_large_diff (__main__.Test_TestCase)
--
Traceback (most recent call last):
  File "../backups/bpo34514.py", line 59, in test_assert_dict_equal_large_diff
self.assertDictEqual(original, expected)
AssertionError: {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, [726 chars]: 99} != 
{101: 101, 102: 102, 103: 103, 104: 104, 10[942 chars] 199}
Diff is 3347 characters long. Set self.maxDiff to None to see it.

==
FAIL: test_assert_dict_equal_small_diff (__main__.Test_TestCase)
--
Traceback (most recent call last):
  File "../backups/bpo34514.py", line 31, in test_assert_dict_equal_small_diff
self.assertDictEqual(original, expected)
AssertionError: {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9} != {101: 
101, 102: 102, 103: 103, 104: 104, 10[42 chars] 109}
- {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9}
+ {101: 101,
+  102: 102,
+  103: 103,
+  104: 104,
+  105: 105,
+  106: 106,
+  107: 107,
+  108: 108,
+  109: 109}

==
FAIL: test_assert_equal_large_diff (__main__.Test_TestCase)
--
Traceback (most recent call last):
  File "../backups/bpo34514.py", line 45, in test_assert_equal_large_diff
self.assertEqual(original, expected)
AssertionError: {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, [726 chars]: 99} != 
{101: 101, 102: 102, 103: 103, 104: 104, 10[942 chars] 199}
Diff is 3347 characters long. Set self.maxDiff to None to see it.

==
FAIL: test_assert_equal_small_diff (__main__.Test_TestCase)
--
Traceback (most recent call last):
  File "../backups/bpo34514.py", line 17, in test_assert_equal_small_diff
self.assertEqual(original, expected)
AssertionError: {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9} != {101: 
101, 102: 102, 103: 103, 104: 104, 10[42 chars] 109}
- {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9}
+ {101: 101,
+  102: 102,
+  103: 103,
+  104: 104,
+  105: 105,
+  106: 106,
+  107: 107,
+  108: 108,
+  109: 109}

--
Ran 4 tests in 3.496s

FAILED (failures=4)


Thanks

--
Added file: https://bugs.python.org/file47764/bpo34514.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34514] assertEqual doesn't use maxDiff when comparing dictionaries

2018-08-27 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

@prudvinit 

Reference : 
https://docs.python.org/3.8/library/unittest.html#unittest.TestCase.maxDiff

> This attribute controls the maximum length of diffs output by assert methods 
> that report diffs on failure. It defaults to 80*8 characters. Assert methods 
> affected by this attribute are assertSequenceEqual() (including all the 
> sequence comparison methods that delegate to it), assertDictEqual() and 
> assertMultiLineEqual().

Thanks

--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34514] assertEqual doesn't use maxDiff when comparing dictionaries

2018-08-26 Thread Prudvi RajKumar Maddala


Prudvi RajKumar Maddala  added the comment:

Hello Victor, can you tell me what is 'maxDiff'? Can you give me a simple 
example of expected output and actual output by taking a simple dictionary?

Thanks

--
nosy: +prudvinit

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34514] assertEqual doesn't use maxDiff when comparing dictionaries

2018-08-26 Thread Victor Engmark


New submission from Victor Engmark :

According to the documentation `assertDictEqual()` "will be used by default to 
compare dictionaries in calls to assertEqual()." Great, since `maxDiff` applies 
to assertDictEqual(). However, `maxDiff` doesn't apply to `assertEqual()` when 
comparing dictionaries.

--
components: Tests
messages: 324140
nosy: Victor Engmark2
priority: normal
severity: normal
status: open
title: assertEqual doesn't use maxDiff when comparing dictionaries
type: behavior
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com