comparison tests/test_outliers.py @ 18:ed109218dd4b branch-tests

rename result scripts and more tests
author Maria Panteli
date Tue, 12 Sep 2017 23:18:19 +0100
parents
children 65b9330afdd8
comparison
equal deleted inserted replaced
17:2e487b9c0a7b 18:ed109218dd4b
1 # -*- coding: utf-8 -*-
2 """
3 Created on Fri Sep 1 19:11:52 2017
4
5 @author: mariapanteli
6 """
7
8 import pytest
9
10 import numpy as np
11 import pandas as pd
12
13 import scripts.outliers as outliers
14
15
16 def test_country_outlier_df():
17 counts = {'a':2, 'b':3}
18 labels = np.array(['a', 'a', 'a', 'a', 'b', 'b', 'b'])
19 df = outliers.country_outlier_df(counts, labels, normalize=True)
20 assert np.array_equal(df['Outliers'].get_values(), np.array([0.5, 1.0]))
21
22
23 def test_normalize_outlier_counts():
24 outlier_counts = {'a':2, 'b':3}
25 country_counts = {'a':4, 'b':3}
26 outlier_counts = outliers.normalize_outlier_counts(outlier_counts, country_counts)
27 outlier_counts_true = {'a':.5, 'b':1.}
28 assert np.array_equal(outlier_counts, outlier_counts_true)
29
30
31 def test_get_outliers_df():
32 assert True