def test_nonascii_entities():
    data = '\n{\n  "luis_schema_version": "2.0",\n  "utterances" : [\n    {\n      "text": "I am looking for a ßäæ ?€ö) item",\n      "intent": "unk",\n      "entities": [\n        {\n          "entity": "description",\n          "startPos": 19,\n          "endPos": 26\n        }\n      ]\n    }\n  ]\n}'
    with tempfile.NamedTemporaryFile(suffix='_tmp_training_data.json') as f:
        f.write(data.encode('utf-8'))
        f.flush()
        td = training_data.load_data(f.name)
        assert (len(td.entity_examples) == 1)
        example = td.entity_examples[0]
        entities = example.get('entities')
        assert (len(entities) == 1)
        entity = entities[0]
        assert (entity['value'] == 'ßäæ ?€ö)')
        assert (entity['start'] == 19)
        assert (entity['end'] == 27)
        assert (entity['entity'] == 'description')
def test_nonascii_entities():
    data = '\n{\n  "luis_schema_version": "2.0",\n  "utterances" : [\n    {\n      "text": "I am looking for a ßäæ ?€ö) item",\n      "intent": "unk",\n      "entities": [\n        {\n          "entity": "description",\n          "startPos": 19,\n          "endPos": 26\n        }\n      ]\n    }\n  ]\n}'
    with tempfile.NamedTemporaryFile(suffix='_tmp_training_data.json') as f:
        f.write(data.encode('utf-8'))
        f.flush()
        td = training_data.load_data(f.name)
        assert (len(td.entity_examples) == 1)
        example = td.entity_examples[0]
        entities = example.get('entities')
        assert (len(entities) == 1)
        entity = entities[0]
        assert (entity['value'] == 'ßäæ ?€ö)')
        assert (entity['start'] == 19)
        assert (entity['end'] == 27)
        assert (entity['entity'] == 'description')