@skip('win32')
def test_dict_to_idict():
 load_iron_python_test()
 from IronPythonTest import DictConversion
 class MyDict(dict, ):
  pass
 class KOld:
  pass
 class KNew(object, ):
  pass
 class KOldDerived(KOld, ):
  pass
 class KNewDerived(KNew, ):
  pass
 test_dicts = [{}, {1: 100}, {None: None}, {object: object}, {1: 100, 2: 200}, {1: 100, 2: 200, 3: 300, 4: 400}, MyDict.__dict__, KOld.__dict__, KNew.__dict__, KOldDerived.__dict__, KNewDerived.__dict__]
 for temp_dict in test_dicts:
  expected = (temp_dict.keys() + temp_dict.values())
  expected.sort()
  to_idict = list(DictConversion.ToIDictionary(temp_dict))
  to_idict.sort()
  AreEqual(to_idict, expected)
  to_idict = list(DictConversion.ToIDictionary(MyDict(temp_dict)))
  to_idict.sort()
  AreEqual(to_idict, expected)

@ skip ( 'win32' ) def test_dict_to_idict ( ) : load_iron_python_test ( ) from IronPythonTest import DictConversion class MyDict ( dict , ) : pass class KOld : pass class KNew ( object , ) : pass class KOldDerived ( KOld , ) : pass class KNewDerived ( KNew , ) : pass test_dicts = [ { } , { 1 : 100 } , { None : None } , { object : object } , { 1 : 100 , 2 : 200 } , { 1 : 100 , 2 : 200 , 3 : 300 , 4 : 400 } , MyDict . __dict__ , KOld . __dict__ , KNew . __dict__ , KOldDerived . __dict__ , KNewDerived . __dict__ ] for temp_dict in test_dicts : expected = ( temp_dict . keys ( ) + temp_dict . values ( ) ) expected . sort ( ) to_idict = list ( DictConversion . ToIDictionary ( temp_dict ) ) to_idict . sort ( ) AreEqual ( to_idict , expected ) to_idict = list ( DictConversion . ToIDictionary ( MyDict ( temp_dict ) ) ) to_idict . sort ( ) AreEqual ( to_idict , expected )
verify dicts can be converted to idictionaries .