def testFreeze(self): "Test freeze" self.assertEqual(freeze([1, 2, 3]), (1, 2, 3)) self.assertEqual(freeze({"list": [1, 2, 3]}), frozenset([("list", (1, 2, 3))])) self.assertEqual( freeze({"dict": {"inner dict": {"list": [1, 2, 3], "string": "test"}}}), frozenset([("dict", frozenset([("inner dict", frozenset([("list", (1, 2, 3)), ("string", "test")]))]))]), )
def testFreeze(self): "Test freeze" self.assertEqual(freeze([1, 2, 3]), (1, 2, 3)) self.assertEqual(freeze({ 'list': [1, 2, 3], }), frozenset([('list', (1, 2, 3))])) self.assertEqual( freeze({ 'dict': { 'inner dict': { 'list': [1, 2, 3], 'string': 'test', }, } }), frozenset([('dict', frozenset([('inner dict', frozenset([ ('list', (1, 2, 3)), ('string', 'test'), ]))]))]))
def testUnfreeze(self): "Test unfreeze" for value, result in [ (freeze([1, 2, 3]), (1, 2, 3)), (freeze({'dict': { 'inner dict': { 'list': [1, 2, 3], 'string': 'test', }, }, }), {'dict': { 'inner dict': { 'list': (1, 2, 3), 'string': 'test', }, }, }), ]: with self.subTest(value=value): self.assertEqual(unfreeze(value), result)
def testFreeze(self): "Test freeze" self.assertEqual(freeze([1, 2, 3]), (1, 2, 3)) self.assertEqual(freeze({ 'list': [1, 2, 3], }), frozenset([('list', (1, 2, 3))])) self.assertEqual(freeze({ 'dict': { 'inner dict': { 'list': [1, 2, 3], 'string': 'test', }, } }), frozenset([('dict', frozenset([('inner dict', frozenset([ ('list', (1, 2, 3)), ('string', 'test'), ]))]))]))