

def test_force_list_callable(self):
    xml = '\n        <config>\n            <servers>\n              <server>\n                <name>server1</name>\n                <os>os1</os>\n              </server>\n            </servers>\n            <skip>\n                <server></server>\n            </skip>\n        </config>\n        '

    def force_list(path, key, value):
        'Only return True for servers/server, but not for skip/server.'
        if (key != 'server'):
            return False
        return (path and (path[(- 1)][0] == 'servers'))
    expectedResult = {
        'config': {
            'servers': {
                'server': [{
                    'name': 'server1',
                    'os': 'os1',
                }],
            },
            'skip': {
                'server': None,
            },
        },
    }
    self.assertEqual(parse(xml, force_list=force_list, dict_constructor=dict), self)

dataset/ETHPy150Open martinblech/xmltodict/tests/test_xmltodict.py XMLToDictTestCase.test_force_list_callable/VarMisuse@131/263 `expectedResult`->`self`