def test_project_all_irr_data(db, test_profile): ''' Creates the test project with 100% irr and adds test data to it. ''' project = create_project('test_project', test_profile, 100, 2) test_data = read_test_data_backend( file='./core/data/test_files/test_no_labels.csv') add_data(project, test_data) return project
def test_project_gnb_data_tfidf(db, test_profile, tmpdir, settings): """This fixture only creates the test project without any data.""" proj = create_project("test_project", test_profile, classifier="gnb") test_data = read_test_data_backend(file="./core/data/test_files/test_no_labels.csv") add_data(proj, test_data) Data.objects.filter(project=proj) matrix = create_tfidf_matrix(proj.pk)[0] data_temp = tmpdir.mkdir("data").mkdir("tf_idf") settings.TF_IDF_PATH = str(data_temp) save_tfidf_matrix(matrix, proj.pk) return proj
def test_fill_multiple_projects(db, test_queue, test_profile): project_data_count = test_queue.project.data_set.count() test_queue.length = project_data_count + 1 test_queue.save() test_project2 = create_project("test_project2", test_profile) project2_data = read_test_data_backend( file="./core/data/test_files/test_no_labels.csv" ) add_data(test_project2, project2_data) fill_queue(test_queue, orderby="random") # Ensure the queue didn't fill any data from the other project assert test_queue.data.count() == project_data_count assert all((d.project == test_queue.project for d in test_queue.data.all()))
def test_project_svm_data_tfidf(db, test_profile, tmpdir, settings): ''' This fixture only creates the test project without any data. ''' proj = create_project('test_project', test_profile, classifier="svm") test_data = read_test_data_backend( file='./core/data/test_files/test_no_labels.csv') add_data(proj, test_data) Data.objects.filter(project=proj) matrix = create_tfidf_matrix(proj.pk)[0] data_temp = tmpdir.mkdir('data').mkdir('tf_idf') settings.TF_IDF_PATH = str(data_temp) save_tfidf_matrix(matrix, proj.pk) return proj
def test_init_redis_multiple_projects(db, test_project_data, test_redis, test_profile): # Try a mix of multiple queues in multiple projects with # and without data to see if everything initializes as expected. p1_queue1 = add_queue(test_project_data, 10) fill_queue(p1_queue1, orderby="random") add_queue(test_project_data, 10) project2 = create_project("test_project2", test_profile) project2_data = read_test_data_backend( file="./core/data/test_files/test_no_labels.csv") add_data(project2, project2_data) p2_queue1 = add_queue(project2, 10) fill_queue(p2_queue1, orderby="random") add_queue(project2, 10) test_redis.flushdb() init_redis() assert_redis_matches_db(test_redis)
def test_create_project(db, test_profile): name = 'test_project' create_project(name, test_profile) assert_obj_exists(Project, {'name': name})
def test_create_project(db, test_profile): name = "test_project" create_project(name, test_profile) assert_obj_exists(Project, {"name": name})
def test_project(db, test_profile): """This fixture only creates the test project without any data.""" return create_project("test_project", test_profile)
def test_project_all_irr_data(db, test_profile): """Creates the test project with 100% irr and adds test data to it.""" project = create_project("test_project", test_profile, 100, 2) test_data = read_test_data_backend(file="./core/data/test_files/test_no_labels.csv") add_data(project, test_data) return project
def test_project_all_irr_3_coders(db, test_profile): """This fixture only creates the test project without any data.""" return create_project("test_project", test_profile, 100, 3)
def test_project_no_irr(db, test_profile): """This fixture only creates the test project without any data and 0% irr.""" return create_project("test_project_no_irr", test_profile, 0, 2)
def test_project(db, test_profile): ''' This fixture only creates the test project without any data. ''' return create_project('test_project', test_profile)
def test_project_all_irr_3_coders(db, test_profile): ''' This fixture only creates the test project without any data. ''' return create_project('test_project', test_profile, 100, 3)
def test_project_no_irr(db, test_profile): ''' This fixture only creates the test project without any data and 0% irr. ''' return create_project('test_project_no_irr', test_profile, 0, 2)