コード例 #1
0
def test_dict_to_string():
    d = {1: 'test',
         2: 4,
         3: 2.8,
         '5': 'text'}
    assert func.dict_to_string(d, ':') == 'test:text'
    d2 = {'one': 1,
          'two': 2,
          'three': 3}
    assert func.dict_to_string(d2, '-') == ''
    d3 = {1: 'one',
          2: 'two',
          3: 'three'}
    assert func.dict_to_string(d3, '-') == 'one-two-three'
コード例 #2
0
ファイル: test_functions.py プロジェクト: skaser/Exercise-1
def test_dict_to_string():
    d = {1: 'test',
         2: 4,
         3: 2.8,
         '5': 'text'}
    assert sorted(func.dict_to_string(d, ':').split(':')
                  ) == sorted(['test', 'text'])
    d2 = {'one': 1,
          'two': 2,
          'three': 3}
    assert func.dict_to_string(d2, '-') == ''
    d3 = {1: 'one',
          2: 'two',
          3: 'three'}
    assert sorted(func.dict_to_string(d3, '-').split('-')
                  ) == sorted(['one', 'two', 'three'])