from unittest import TestCase
from recommender import Recommender

# TODO: write proper testcases

class AllInOne(TestCase):
    def recommend(self):
        recom = Recommender(documents_n = 20, persons_n = 20)
        for vizit in Data():
            recom.record(vizit[0], vizit[1])
        self.assertEqual(recom.recommend('430586149'), ['433940066', '431329924', '433862262'])
            

class Data(object):
    def __iter__(self):
        raw = self.raw().split('\n')
        for line in raw:
            yield line.split(',')

    def raw(self):
        return """430592357,ZvCTasj4
430586149,ZvCTasj4
201397816,ZyrCGvQQ
214597966,ZSV4Hkiw
430584391,zy0RUZnG
431065083,ZvCTasj4
201361464,ZyrCGvQQ
302482929,ZSV4Hkiw
330117582,ZvCTasj4
433862262,ZSOmPzCw
426482194,ZSOmPzCw
425224044,ZSOmPzCw
201369542,ZzVi46JN
363734570,ZZS1KlwN
431246574,ZxqvpImX
431249575,ZxqvpImX
201359004,ZzVi46JN
430466714,zy0RUZnG
319731179,ZxqvpImX
431246574,zXRRGKfX
430716481,zXRRGKfX
201362184,Zsl8FsLx
430466714,zXRRGKfX
324918927,ZSV4Hkiw
201361657,ZzVi46JN
424384375,ZSOmPzCw
431293112,ZSV4Hkiw
430519225,ZzVi46JN
330117582,ZYw24l7D
382903817,ZvAD7jk3
201423486,ZvAD7jk3
433862262,zwBr9yLl
430347776,zXRRGKfX
250683776,zXHGOep9
390255494,zXHGOep9
336148236,zXHGOep9
419502781,ZvAD7jk3
433178444,zwBr9yLl
412161719,ZvAD7jk3
429615716,zy0RUZnG
431246574,ZYw24l7D
201377744,ZYw24l7D
433650250,zwBr9yLl
431293112,zXHGOep9
425225457,zy0RUZnG
391386058,ZTJaUd81
422313668,ZTJaUd81
201369659,ZY1KyJuH
431293112,ZTJaUd81
201379948,ZY1KyJuH
430716481,ZTJaUd81
201366382,zWNxGYWo
201357695,ZY1KyJuH
433862262,Zsl8FsLx
430651758,ZWSlLHdc
431304967,Zsl8FsLx
201360390,ZY1KyJuH
430716481,Zsl8FsLx
430658308,ZWSlLHdc
330117582,ZWSlLHdc
431065083,ZWSlLHdc
431246574,ZxqvpImX
433178444,Zt3n32p0
250683776,Zt3n32p0
319731179,zWNxGYWo
330117582,Zt3n32p0
430347776,Zt3n32p0
201362419,zWNxGYWo
412161719,Zv8Uozhb
433862262,ZSnRUCB6
433178444,ZSnRUCB6
431329924,ZSnRUCB6
431293112,ZSnRUCB6
201366382,zWNxGYWo
201397816,ZyrCGvQQ
201366633,ZyrCGvQQ
422313668,Zv8Uozhb
363734570,Zv8Uozhb
371894284,Zv8Uozhb
429110215,zUl2imWb
430609436,ZZS1KlwN
433862262,zxKKxPIY
431304967,ZYnhGo6X
201361023,zUl2imWb
201382402,ZYw24l7D
433862262,ZYnhGo6X
429615716,ZZS1KlwN
201379347,zxKKxPIY
422313668,ZZS1KlwN
201359861,zxKKxPIY
201361844,zxKKxPIY
201721820,zUl2imWb
431244481,ZYnhGo6X
431293112,zUl2imWb
201358641,zwBr9yLl
201362419,ZYnhGo6X
433940066,zyYIkGkk
433862262,zyYIkGkk
431329924,zyYIkGkk
430586149,zyYIkGkk"""

