Esempio n. 1
0
def test_compilerGames_getAppearanceList():
    log = Log('test.log')
    compiler = CompilerGames(log)
    appList = compiler.getAppearanceList()
    assert isinstance(appList, list)
    assert isinstance(appList[0], dict)
    assert isinstance(appList[0]['GameID'], int)
    assert isinstance(appList[0]['TeamID'], int)
    assert isinstance(appList[0]['PlayerID'], int)
Esempio n. 2
0
def compileGames():
    # This is the compiler for game-level summary data
    # This is the first compilation step.
    print('Compiling games data')
    log = Log('trapp-compile-games.log')
    log.message('Compiling games data')
    c = CompilerGames(log)
    c.doCompile()
    log.end()
Esempio n. 3
0
def test_compilerGames_assembleStatLine_unused_sub():
    log = Log('test.log')
    compiler = CompilerGames(log)
    # Unused substitute
    record = {
        'GameID': 1,
        'TeamID': 1,
        'PlayerID': 1,
        'TimeOn': 0,
        'TimeOff': 0,
        'Ejected': 0
    }
    result = compiler.assembleStatLine(record)
    assert result['GS'] == 0
    assert result['GP'] == 0
Esempio n. 4
0
def test_compilerGames_assembleStatLine_ejected_sub():
    log = Log('test.log')
    compiler = CompilerGames(log)
    # Substitute, then ejected
    record = {
        'GameID': 1,
        'TeamID': 1,
        'PlayerID': 1,
        'TimeOn': 62,
        'TimeOff': 87,
        'Ejected': 1
    }
    result = compiler.assembleStatLine(record)
    assert result['GS'] == 0
    assert result['GP'] == 1
    assert result['RC'] == 1
Esempio n. 5
0
def test_compilerGames_assembleStatLine_starter():
    log = Log('test.log')
    compiler = CompilerGames(log)
    # Started, played whole game
    record = {
        'GameID': 1,
        'TeamID': 1,
        'PlayerID': 1,
        'TimeOn': 0,
        'TimeOff': 90,
        'Ejected': 0
    }
    result = compiler.assembleStatLine(record)
    assert isinstance(result, dict)
    assert result['GS'] == 1
    assert result['GP'] == 1
    assert result['RC'] == 0
Esempio n. 6
0
def test_compilerGames_getEventSummary():
    log = Log('test.log')
    compiler = CompilerGames(log)
    needle = {'GameID': 1, 'TeamID': 1, 'PlayerID': 1}
    result = compiler.getEventSummary(needle)
    # Format of response
    assert isinstance(result, dict)
    assert isinstance(result['Goals'], int)
    assert isinstance(result['Ast'], int)
    # Response includes original needle
    assert result['GameID'] == 1
    assert result['TeamID'] == 1
    assert result['PlayerID'] == 1
    # Unfound needles still return zeros
    needle = {'GameID': 184, 'TeamID': 3892, 'PlayerID': 2981}
    result = compiler.getEventSummary(needle)
    assert result['Goals'] == 0
    assert result['Ast'] == 0
Esempio n. 7
0
def test_compilerGames_setLog():
    log = Log('test.log')
    log2 = Log('test2.log')
    compiler = CompilerGames(log)
    compiler.setLog(log2)
    assert compiler.log.name == 'test2.log'