File: test_tokenizer.py

package info (click to toggle)
freeorion 0.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 194,940 kB
  • sloc: cpp: 186,508; python: 40,969; ansic: 1,164; xml: 719; makefile: 32; sh: 7
file content (11 lines) | stat: -rw-r--r-- 498 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
from common.statistic_interface import StatKey
from log_parser.log_tokenizer import _get_token_from_line


def test_token_parser():
    line = "12:06:13.179169 {0x00002e80} [debug] python : statistic.py:30 : ##EmpireID:empire_id: 2, name: Binding_2_pid_2_AI_1_RIdx_4_Aggressive, turn: 1"
    token = _get_token_from_line(line)
    assert len(token) == 2
    key, val = token
    assert key == StatKey.EmpireID
    assert val == "empire_id: 2, name: Binding_2_pid_2_AI_1_RIdx_4_Aggressive, turn: 1"