# process_new_tester.py
# -------
# Tests for databases.py ProcessedNewsDatabase
import databases as d

pndb = d.ProcessedNewsDatabase("../news_measures.csv")
"""
dict = pndb.data["AAPL"]
for k in dict:
    print(k, dict[k])
20010104 6
20010105 1
20010106 4
20010108 6
20010109 20
20010110 10
20010111 7
20010112 1
20010113 3
20010115 4
20010116 3
20010117 31
20010118 17
20010119 4
20010120 1
20010122 5
20010125 1
20010126 2
20010201 3
20010207 2
20010208 2
20010209 8
20010222 7
20010223 2
20010228 3
20010301 3
20010302 3
20010306 5
20010308 2
20010309 10
20010312 4
20010314 5
20010315 2
20010316 1
20010320 1
20010321 3
20010322 4
20010323 11
20010326 2
20010328 2
20010329 4
20010330 1
20010404 1
20010405 7
20010406 3
20010411 2
20010412 3
20010413 3
20010418 48
20010419 17
20010420 6
20010423 2
20010424 3
20010425 1
20010426 3
20010427 1
20010501 4
20010502 1
20010503 1
20010507 1
20010509 3
20010510 1
20010511 1
20010515 5
20010516 5
20010517 1
20010519 2
20010521 12
20010523 2
20010524 1
20010525 1
20010530 1
20010531 1
20010605 2
20010606 2
20010620 4
20010621 1
20010625 1
20010626 1
20010627 1
20010628 1
20010703 5
20010705 1
20010706 1
20010711 2
20010713 1
20010717 28
20010718 37
20010719 11
20010720 2
20010723 1
20010726 1
20010803 1
20010809 2
20010811 3
20010813 4
20010814 2
20010815 2
20010816 2
20010823 1
20010824 3
20010830 1
20010831 1
20010901 2
20010904 7
20010905 3
20010906 5
20010907 1
20010908 3
20010912 1
20010913 3
20010917 2
20010918 5
20010919 2
20010925 5
20010926 4
20011002 4
20011004 4
20011005 2
20011008 1
20011013 1
20011016 7
20011017 41
20011018 11
20011019 1
20011023 2
20011024 3
20011025 3
20011031 1
20011101 2
20011107 2
20011109 4
20011110 2
20011113 1
20011115 1
20011116 1
20011120 3
20011121 3
20011122 1
20011123 1
20011127 6
20011128 4
20011129 2
20011206 1
20011207 7
20011210 5
20011211 1
20011212 2
20011213 1
20011214 1
20011217 1
20011218 1
20011219 1
20011221 1
20011227 4
20020103 7
20020105 1
20020107 19
20020108 3
20020109 6
20020110 4
20020111 3
20020114 2
20020115 2
20020116 32
20020117 18
20020118 6
20020119 2
20020123 2
20020124 1
20020128 4
20020130 1
20020131 1
20020205 1
20020206 1
20020207 3
20020212 7
20020213 1
20020214 1
20020215 5
20020221 1
20020225 3
20020228 4
20020301 1
20020308 2
20020312 1
20020314 4
20020315 2
20020321 27
20020323 1
20020405 5
20020407 4
20020408 3
20020410 2
20020411 6
20020415 1
20020416 3
20020417 32
20020418 9
20020419 1
20020423 1
20020424 1
20020425 3
20020426 3
20020428 1
20020429 18
20020502 4
20020503 3
20020506 1
20020507 3
20020508 4
20020509 1
20020511 1
20020513 1
20020514 3
20020515 2
20020516 1
20020517 2
20020520 4
20020604 3
20020605 1
20020610 2
20020611 1
20020612 1
20020613 2
20020617 1
20020618 38
20020619 34
20020620 4
20020621 4
20020622 1
20020624 1
20020627 2
20020629 2
20020701 4
20020702 1
20020703 1
20020710 3
20020711 3
20020712 2
20020715 5
20020716 27
20020717 19
20020719 5
20020720 2
20020724 1
20020725 3
20020813 5
20020814 1
20020815 1
20020822 3
20020824 1
20020828 2
20020903 1
20020905 2
20020906 1
20020910 2
20020912 1
20020918 2
20020920 5
20020925 1
20020926 1
20021001 4
20021002 3
20021003 2
20021004 1
20021014 2
20021015 2
20021016 27
20021017 14
20021018 2
20021030 2
20021031 1
20021104 1
20021106 10
20021107 2
20021125 1
20021126 1
20021128 1
20021203 1
20021204 2
20021205 1
20021206 2
20021211 1
20021212 1
20021213 1
20021217 3
20021218 1
20021219 6
20030106 1
20030107 22
20030108 3
20030109 4
20030110 1
20030113 3
20030114 5
20030115 20
20030116 7
20030118 2
20030120 2
20030121 1
20030122 1
20030123 1
20030128 1
20030129 1
20030130 2
20030131 2
20030204 3
20030206 1
20030207 2
20030210 2
20030211 3
20030218 1
20030219 1
20030220 3
20030221 1
20030227 1
20030304 3
20030305 1
20030307 1
20030319 6
20030320 11
20030401 2
20030402 3
20030403 1
20030406 2
20030411 4
20030414 5
20030416 42
20030417 9
20030418 1
20030423 2
20030424 2
20030425 4
20030428 10
20030429 4
20030430 2
20030501 3
20030505 9
20030506 11
20030507 1
20030508 4
20030509 1
20030513 2
20030514 6
20030515 3
20030516 1
20030517 1
20030519 1
20030520 2
20030521 5
20030523 1
20030524 2
20030528 1
20030530 2
20030531 2
20030602 1
20030603 3
20030604 1
20030605 1
20030607 1
20030611 12
20030612 1
20030613 1
20030617 3
20030618 5
20030619 1
20030620 6
20030623 27
20030624 4
20030625 1
20030626 2
20030627 1
20030709 1
20030711 3
20030714 4
20030715 1
20030716 27
20030717 5
20030719 2
20030722 1
20030723 2
20030731 1
20030806 19
20030807 2
20030811 2
20030813 1
20030814 3
20030819 1
20030821 2
20030828 8
20030829 1
20030903 1
20030904 1
20030905 2
20030906 1
20030908 11
20030909 3
20030910 1
20030911 1
20030912 3
20030915 4
20030916 6
20030917 3
20030918 2
20030919 2
20030921 1
20030922 3
20030923 1
20030924 2
20030925 17
20030929 2
20030930 1
20031002 1
20031008 10
20031009 3
20031010 1
20031013 4
20031015 50
20031016 45
20031017 3
20031018 1
20031020 4
20031021 1
20031022 9
20031023 2
20031024 1
20031030 6
20031103 1
20031104 2
20031105 3
20031106 6
20031107 1
20031110 5
20031113 3
20031115 2
20031116 3
20031117 2
20031118 6
20031119 13
20031120 5
20031121 2
20031126 1
20031127 2
20031201 2
20031202 7
20031203 4
20031204 6
20031205 1
20031211 2
20031212 3
20031215 4
20031216 7
20031217 3
20031218 5
20031219 3
20031222 4
20031223 1
20031229 8
20031231 1
20040105 2
20040106 46
20040107 6
20040108 22
20040109 5
20040110 5
20040112 7
20040113 5
20040114 48
20040115 23
20040116 2
20040120 1
20040121 2
20040122 6
20040123 1
20040124 1
20040127 2
20040128 7
20040129 2
20040130 2
20040202 2
20040203 1
20040204 3
20040205 13
20040206 4
20040209 2
20040210 10
20040211 3
20040213 3
20040217 4
20040218 4
20040219 2
20040223 3
20040224 1
20040225 2
20040226 8
20040301 2
20040302 2
20040303 3
20040305 5
20040308 2
20040309 2
20040310 1
20040311 15
20040315 1
20040316 8
20040317 1
20040318 31
20040319 2
20040320 3
20050103 5
20050104 7
20050105 3
20050106 7
20050107 8
20050108 1
20050110 7
20060103 9
20060104 9
20060105 15
20060106 21
20060107 10
20060108 2
20060109 10
20060110 57
20060111 27
20060112 24
20060113 10
20060114 4
20060115 1
20060116 8
20060117 11
20060118 43
20060119 36
20060120 10
20060121 6
20060122 1
20060123 8
20060124 9
20060125 8
20060126 10
20060127 10
20060128 1
20060129 1
20060130 7
20060131 7
20060201 8
20060202 13
20060203 2
20060204 3
20060205 1
20060206 9
20060207 15
20060208 5
20060209 6
20060210 12
20060211 1
20060212 1
20060213 4
20060214 10
20060215 5
20060216 13
20060217 9
20060219 1
20060220 1
20060221 3
20060222 7
20060223 8
20060225 2
20060226 1
20060227 6
20060228 31
20060301 11
20060302 4
20060303 15
20060305 1
20060306 8
20060307 4
20060308 5
20060309 6
20060310 7
20060311 5
20060312 1
20060313 12
20060314 7
20060315 3
20060316 4
20060317 7
20060318 5
20060319 1
20060320 4
20060321 18
20060322 16
20060323 3
20060324 5
20060326 1
20060327 7
20060328 27
20060329 15
20060330 14
20060331 11
20060401 1
20060402 1
20060403 7
20060404 14
20060405 35
20060406 20
20060407 9
20060408 3
20060409 1
20060410 3
20060411 14
20060412 16
20060413 10
20060415 1
20060416 1
20060417 7
20060418 1
20060419 35
20060420 27
20060421 12
20060423 3
20060424 25
20060425 6
20060426 20
20060427 4
20060428 5
20060429 3
20060430 2
20060501 8
20060502 12
20060503 13
20060504 4
20060505 6
20060507 1
20060508 25
20060509 7
20060510 9
20060511 6
20060512 7
20060513 1
20060514 2
20060515 14
20060516 17
20060517 3
20060518 7
20060519 9
20060521 1
20060522 10
20060523 15
20060524 11
20060525 6
20060526 3
20060528 1
20060529 2
20060530 4
20060531 8
20060601 2
20060602 4
20060604 1
20060605 2
20060606 5
20060607 5
20060608 9
20060609 8
20060610 1
20060612 2
20060613 10
20060614 20
20060615 8
20060616 9
20060617 1
20060619 3
20060620 8
20060621 5
20060622 11
20060623 3
20060624 3
20060626 4
20060627 2
20060628 7
20060629 24
20060630 24
20060701 1
20060703 4
20060704 1
20060705 17
20060706 8
20060707 4
20060710 5
20060711 3
20060712 10
20060713 10
20060714 5
20060715 3
20060717 15
20060718 7
20060719 39
20060720 25
20060721 11
20060722 2
20060724 5
20060725 6
20060726 6
20060727 7
20060728 7
20060731 19
20060801 5
20070102 6
20070103 12
20070104 16
20070105 9
20070106 4
20070107 1
20070108 11
20070109 89
20070110 62
20070111 44
20070112 29
20070113 8
20070115 2
20070116 17
20070117 55
20070118 52
20070119 15
20070120 6
20070122 6
20070123 14
20070124 14
20070125 17
20070126 6
20070127 7
20070129 9
20070130 7
20070131 12
20070201 13
"""
print("Expected: -1 Actual: " + str(pndb.abnormalStories("AAPL", "20010104")))
"""
Found dates in following query
20010308
20010309
20010310
20010311
20010312
20010313
20010314
20010315
20010316
20010317
20010318
20010319
20010320
20010321
20010322
20010323
20010324
20010325
20010326
20010327
20010328
20010329
20010330
20010331
20010401
20010402
20010403
20010404
20010405
20010406
20010407
20010408
20010409
20010410
20010411
20010412
20010413
20010414
20010415
20010416
20010417
20010418
20010419
20010420
20010421
20010422
20010423
20010424
20010425
20010426
20010427
20010428
20010429
20010430
20010501
20010502
20010503
20010504
20010505
20010506
"""
print("Expected: -2.4364 Actual: " + str(pndb.abnormalStories("AAPL", "20010507")))

