Skip to content
This repository has been archived by the owner on Mar 1, 2018. It is now read-only.

Commit

Permalink
Test monthly subquota limits
Browse files Browse the repository at this point in the history
  • Loading branch information
Irio committed Jan 19, 2017
1 parent d8a972d commit 3ef70ee
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 6 deletions.
27 changes: 27 additions & 0 deletions tests/fixtures/monthly_subquota_limit_classifier.csv
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,30 @@ applicant_id,subquota_number,issue_date,year,month,total_net_value
4,122,2015-06-01,2015,6,2000
4,122,2015-06-01,2015,6,701
4,122,2015-06-01,2015,6,10
1,3,2015-09-01,2015,9,5000
1,3,2015-09-01,2015,9,1001
2,3,2015-10-01,2015,10,5000
2,3,2015-10-01,2015,10,999
3,3,2015-11-01,2015,11,5000
3,3,2015-11-01,2015,11,1000
4,3,2015-12-01,2015,12,5000
4,3,2015-12-01,2015,12,1001
4,3,2015-12-01,2015,12,10
1,8,2015-03-01,2015,3,8000
1,8,2015-03-01,2015,3,701
2,8,2015-04-01,2015,4,8000
2,8,2015-04-01,2015,4,699
3,8,2015-05-01,2015,5,8000
3,8,2015-05-01,2015,5,700
4,8,2015-06-01,2015,6,8000
4,8,2015-06-01,2015,6,701
4,8,2015-06-01,2015,6,10
1,137,2015-10-01,2015,10,7000
1,137,2015-10-01,2015,10,698
2,137,2015-11-01,2015,11,7000
2,137,2015-11-01,2015,11,697
3,137,2015-12-01,2015,12,7000
3,137,2015-12-01,2015,12,697.16
4,137,2016-01-01,2016,1,7000
4,137,2016-01-01,2016,1,698
4,137,2016-01-01,2016,1,10
18 changes: 12 additions & 6 deletions tests/test_monthly_subquota_limit_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,25 @@ def setUp(self):
self.prediction = self.subject.predict(self.dataset)

def test_predict_false_when_not_in_date_range(self):
assert_array_equal(np.repeat(False, 4),
self.prediction[[0, 1, 9, 10]])
assert_array_equal(np.repeat(False, 10),
self.prediction[[0, 1, 9, 10, 18, 19, 27, 28, 36, 37]])

def test_predict_false_when_under_the_limit(self):
assert_array_equal(np.repeat(False, 4),
self.prediction[[2, 3, 11, 12]])
assert_array_equal(np.repeat(False, 10),
self.prediction[[2, 3, 11, 12, 20, 21, 29, 30, 38, 39]])

def test_predict_false_when_exactly_on_the_limit(self):
assert_array_equal(np.repeat(False, 4),
self.prediction[[4, 5, 13, 14]])
assert_array_equal(np.repeat(False, 10),
self.prediction[[4, 5, 13, 14, 22, 23, 31, 32, 40, 41]])

def test_predict_true_when_over_the_limit(self):
assert_array_equal(np.r_[[False, True, True]],
self.prediction[[6, 7, 8]])
assert_array_equal(np.r_[[False, True, True]],
self.prediction[[15, 16, 17]])
assert_array_equal(np.r_[[False, True, True]],
self.prediction[[24, 25, 26]])
assert_array_equal(np.r_[[False, True, True]],
self.prediction[[33, 34, 35]])
assert_array_equal(np.r_[[False, True, True]],
self.prediction[[42, 43, 44]])

0 comments on commit 3ef70ee

Please sign in to comment.