<commit_before>'''
Created on Nov 12, 2013

@author: <NAME>
'''

from nose.tools import assert_almost_equals

import source.generative_algo as gen
import source.expressions as expr

def dummyPoisson(x,y): return 10
def dummyDistr15(): return 0.5

def test_selectBooksForFirstReader():
    # using dummy functions: poisson distribution always returns 10, distr. (15) always 0.5
    numBooks, bookScores = gen.selectBooksForFirstReader(0,
                                                     expr.Parameters(1.0, 1.0, 1.0),
                                                     poissonFunction=dummyPoisson,
                                                     sampleFrom15Function=dummyDistr15
                                                     ) 
    assert numBooks == 10
    assert len(bookScores) == 10
    print bookScores
    for score in bookScores.values(): assert_almost_equals(0.5, score)

def test_selectBooksForIthReader_condition1():
    # TODO: implement
    assert False

def test_selectBooksForIthReader_condition2():
    # TODO: implement
    assert False

def test_generateBipartiteGraph_condition1():
    # TODO: implement
    assert False
<commit_msg>fixed call of sampler eq 15<commit_after>'''
Created on Nov 12, 2013

@author: <NAME>
'''

from nose.tools import assert_almost_equals

import source.generative_algo as gen
import source.expressions as expr

def dummyPoisson(x,y): return 10
def dummyDistr15(a,b,c,d): return 0.5

def test_selectBooksForFirstReader():
    # using dummy functions: poisson distribution always returns 10, distr. (15) always 0.5
    numBooks, bookScores = gen.selectBooksForFirstReader([0],
                                                     expr.Parameters(1.0, 1.0, 1.0),
                                                     poissonFunction=dummyPoisson,
                                                     sampleFrom15Function=dummyDistr15
                                                     ) 
    assert numBooks == 10
    assert len(bookScores) == 10
    print bookScores
    for score in bookScores.values(): assert_almost_equals(0.5, score)

def test_selectBooksForIthReader_condition1():
    # TODO: implement
    assert False

def test_selectBooksForIthReader_condition2():
    # TODO: implement
    assert False

def test_generateBipartiteGraph_condition1():
    # TODO: implement
    assert False

{'fraction_non_alphanumeric': 0.07145877378435518, 'fraction_numerical': 0.03298097251585624, 'mean_word_length': 2.146276595744681, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5438336', 'n_tokens_mistral': 679, 'n_tokens_neox': 604, 'n_words': 169}