[Tutor] dictionaries are same but returning false

Peter Otten __peter__ at web.de
Wed Jul 5 16:01:57 EDT 2017


Ashfaq wrote:

> Hi Peter,
> The way you find the issue is really cool! Very cool! :)

Thanks ;)

Here's a bonus solution:

>>> import unittest
>>> class T(unittest.TestCase):
...     def test_xy(self):
...         self.maxDiff = None
...         self.assertEqual(x, y)
... 
>>> unittest.main()
F
======================================================================
FAIL: test_xy (__main__.T)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "<stdin>", line 4, in test_xy
AssertionError: {'att[483 chars]in': '22', 'max': '22'}}, '_is_stateless': 
Fal[23 chars]/24'} != {'att[483 chars]in': 22, 'max': 22}}, '_is_stateless': 
False, [19 chars]/24'}
  {'_icmp_options': None,
   '_is_stateless': False,
   '_protocol': '6',
   '_source': '0.0.4.0/24',
-  '_tcp_options': {'destination_port_range': {'max': '22', 'min': '22'},
?                                                     -  -         -  -

+  '_tcp_options': {'destination_port_range': {'max': 22, 'min': 22},
                    'source_port_range': None},
   '_udp_options': None,
   'attribute_map': {'icmp_options': 'icmpOptions',
                     'is_stateless': 'isStateless',
                     'protocol': 'protocol',
                     'source': 'source',
                     'tcp_options': 'tcpOptions',
                     'udp_options': 'udpOptions'},
   'swagger_types': {'icmp_options': 'IcmpOptions',
                     'is_stateless': 'bool',
                     'protocol': 'str',
                     'source': 'str',
                     'tcp_options': 'TcpOptions',
                     'udp_options': 'UdpOptions'}}

----------------------------------------------------------------------
Ran 1 test in 0.008s

FAILED (failures=1)
$ 




More information about the Tutor mailing list