def test_importerror(): try: a = ngvoc.get_vocabulary(voc_type='thereisnosuchclass') except ImportError as e: if len(e.args) and len( e.args[0]) > 14 and e.args[0][:15] == 'No such class: ': pass else: raise
def tempvoc4(request): param = request.param v = ngvoc.get_vocabulary(voc_type=param) meanings = ['a','b','c','d','e','f'] words = list(range(-4,10)) v.discover_meanings(meanings) v.discover_words(words) assoc_list = [ (random.choice(meanings),random.choice(words)) for i in range(25)] for assoc in assoc_list: v.add(m=assoc[0],w=assoc[1],val=round(random.random(),3)) v.assoc_list = assoc_list return v
def tempvoc3(request): param = request.param v = ngvoc.get_vocabulary(voc_type=param) meanings = ['a', 'b', 'c', 'd', 'e', 'f'] words = range(-4, 10) v.discover_meanings(meanings) v.discover_words(words) assoc_list = [(random.choice(meanings), random.choice(words)) for i in range(25)] for assoc in assoc_list: v.add(m=assoc[0], w=assoc[1]) v.assoc_list = assoc_list return v
def tempvoc2(request): param = request.param v = ngvoc.get_vocabulary(voc_type=param) meanings = ['a', 'b', 'c', 'd', 'e', 'f'] words = range(-4, 10) v.discover_meanings(meanings) v.discover_words(words) assoc_list = [ ('a', 0), ('b', 0), ('a', 1), ('e', 9), ('c', 1), ('d', 1), ] for assoc in assoc_list: v.add(m=assoc[0], w=assoc[1]) v.assoc_list = assoc_list return v
def tempvoc2(request): param = request.param v = ngvoc.get_vocabulary(voc_type=param) meanings = ['a','b','c','d','e','f'] # words = holedrange.HoledRange(14) words = list(range(-4,10)) v.discover_meanings(meanings) v.discover_words(words) assoc_list = [ ('a',0), ('b',0), ('a',1), ('e',9), ('c',1), ('d',1), ] for assoc in assoc_list: v.add(m=assoc[0],w=assoc[1]) v.assoc_list = assoc_list return v
def tempvoc(request): param = request.param return ngvoc.get_vocabulary(voc_type=param)
def test_import(voc_type): v = ngvoc.get_vocabulary(voc_type=voc_type)
def test_importerror(): try: a = ngvoc.get_vocabulary(voc_type='thereisnosuchclass') except ImportError as e: assert len(e.args) and len(e.args[0])>14 and e.args[0][:15] == 'No such class: '