def test_extensions_entropy_jsp(self): actual = extensions_entropy(self.ds) jsp_e = -(2 / 6) * get_log(2 / 6) - (2 / 4) * get_log( 2 / 4) - (1 / 4) * get_log(1 / 4) self.assertEqual(jsp_e, actual.get('dev1').get('.jsp'), 'test_extensions_entropy_jsp')
def test_extensions_entropy_py(self): actual = extensions_entropy(self.ds) py_e = -(1 / 2) * get_log(1 / 2) - (1 / 7) * get_log( 1 / 7) - (1 / 4) * get_log(1 / 4) self.assertEqual(py_e, actual.get('dev2').get('.py'), 'test_extensions_entropy_py')
def test_extensions_entropy_php(self): actual = extensions_entropy(self.ds) php_e = -(1 / 6) * get_log(1 / 6) - (1 / 4) * get_log( 1 / 4) - (1 / 2) * get_log(1 / 2) self.assertEqual(php_e, actual.get('dev1').get('.php'), 'test_extensions_entropy_php')
def test_extensions_entropy_java(self): actual = extensions_entropy(self.ds) java_e = -(1 / 2) * get_log(1 / 2) - (1 / 4) * get_log( 1 / 4) - (1 / 4) * get_log(1 / 4) - (1) * get_log(1) self.assertEqual(java_e, actual.get('dev1').get('.java'), 'test_extensions_entropy_java')
def test_extension_distribution(self): ext = extensions_entropy(self.ds) java_e = -(1 / 2) * get_log(1 / 2) - (1 / 4) * get_log( 1 / 4) - (1 / 4) * get_log(1 / 4) - (1) * get_log(1) data = {'good': ext} actual = extension_distribution(data) self.assertEqual(actual['good'][1], ['dev1 .java', java_e], 'test_extension_distribution')
def test_get_extremes_avg(self): ext = extensions_entropy(self.ds_extended) data = {'good': ext, 'bad': ext} extremes, avgs = get_extremes_avg(data) jsp_e = -(2 / 6) * get_log(2 / 6) - (2 / 4) * get_log( 2 / 4) - (1 / 4) * get_log(1 / 4) self.assertEqual(len(extremes['good']), 0, 'test_get_extremes_avg list of min should be empty') self.assertEqual(avgs['good']['.jsp'][1], set(['dev1']), 'test_get_extremes_avg avg developers .jsp') self.assertEqual(avgs['good']['.java'][1], set(['dev1', 'dev3', 'dev4']), 'test_get_extremes_avg avg developers .jsp') self.assertEqual(avgs['good']['.jsp'][0], jsp_e, 'test_get_extremes_avg avg entropy sum .jsp') self.assertEqual(avgs['good']['.jsp'][2], jsp_e, 'test_get_extremes_avg avg entropy avg .jsp')
def picks(): access = helper.Show_Logs if request.method == "POST": helper.Show_Logs = int(request.form['logs']) return("Success") if request.method == "GET": if access: nflpicks,header = helper.get_nflpicks() scores = helper.check_scores() log = helper.get_log() return render_template('log.html', nflpicks=nflpicks, header=header, winners=scores, logos=helper.nfl_logos) else: return "<h1>Come back once the first game starts on sunday</h1>"
def admin_logs(): nflpicks,header = helper.get_nflpicks() scores = helper.check_scores() log = helper.get_log() return render_template('adminLogs.html', nflpicks=nflpicks, header=header, logs=log, winners=scores, log=helper.Show_Logs, forms=helper.Hide_forms)