def test_json_not_vtnstandard(): vtn = {"objectively": "not a vtn-standard structure"} try: result = process_json(vtn, "word") assert False except Exception as e: assert 'not a valid vtn-standard transcription' in str(e)
def test_json(): vtn = { "series": [ { "words": [{ "word": "That's pretty good.", "confidence": 0.9, }], }, ] } result = process_json(vtn, "word") assert 'series' in result assert hasPositiveSentiment(result['series'][0])
def test_json_everything(): vtn = { "series": [ { "words": [{ "word": "That's pretty good.", "confidence": 0.9, }], }, ] } result = process_json(vtn, "sentence,word,document") assert 'series' in result assert hasPositiveSentiment(result['series'][0]) # has word sentiment assert 'object' in result # has sentence sentiment assert 'sentiment' in result # has document sentiment
def test_json_sentence(): vtn = { "series": [ { "words": [{ "word": "That's pretty good.", "confidence": 0.9, }], }, ] } result = process_json(vtn, "sentence") assert 'series' in result assert hasNoSentiment(result['series'][0]) # no word sentiment assert 'object' in result # has sentence sentiment assert 'sentiment' not in result # no document sentiment
def test_json_selects_highest_confidence(): vtn = { "series": [ { "words": [{ "word": "That's pretty good.", "confidence": 0.9, }, { "word": "That's sucks.", "confidence": 0.97, }], }, ] } result = process_json(vtn, "word") assert 'series' in result assert hasNegativeSentiment(result['series'][0])
def test_json_punctuation(): vtn = { "series": [ { "words": [{ "word": "Hello" }] }, { "words": [{ "word": "!" }] }, ] } result = process_json(vtn, "word") assert 'series' in result assert hasZeroSentiment(result['series'][1])