Ejemplo n.º 1
0
def test_read_file_line_by_line():
    assert parse_file.read_file('input.txt') == [
        '10|1|SELL|toaster_1|10.00|20',
        '12|8|BID|toaster_1|7.50',
        '13|5|BID|toaster_1|12.50',
        '15|8|SELL|tv_1|250.00|20',
        '16',
        '17|8|BID|toaster_1|20.00',
        '18|1|BID|tv_1|150.00',
        '19|3|BID|tv_1|200.00',
        '20',
        '21|3|BID|tv_1|300.00']
Ejemplo n.º 2
0
def write():
    """write on screen"""
    width = render.getWindowWidth()
    height = render.getWindowHeight()

    # OpenGL setup
    bgl.glMatrixMode(bgl.GL_PROJECTION)
    bgl.glLoadIdentity()
    bgl.gluOrtho2D(0, width, 0, height)
    bgl.glMatrixMode(bgl.GL_MODELVIEW)
    bgl.glLoadIdentity()

    # BLF drawing routine
    blf.size(font_id, height // 40, 72)
    data = parse_file.read_file()
    data = data.splitlines()
    linePosition = height * 0.8
    for str in data:
        str_len = len(str)
        blf.position(font_id, (width * 0.05), linePosition, 0)
        blf.enable(font_id, blf.SHADOW)
        blf.shadow(font_id, 0, 1.0, 0.2, 0.0, 1.0)
        blf.draw(font_id, str)
        linePosition -= height * 0.05
Ejemplo n.º 3
0
def write():
    """write on screen"""
    width = render.getWindowWidth()
    height = render.getWindowHeight()

    # OpenGL setup
    bgl.glMatrixMode(bgl.GL_PROJECTION)
    bgl.glLoadIdentity()
    bgl.gluOrtho2D(0, width, 0, height)
    bgl.glMatrixMode(bgl.GL_MODELVIEW)
    bgl.glLoadIdentity()

    # BLF drawing routine
    blf.size(font_id, height//40, 72)
    data = parse_file.read_file()
    data = data.splitlines()
    linePosition = height * 0.8
    for str in data:
        str_len = len(str)
        blf.position(font_id, (width * 0.05), linePosition, 0)
        blf.enable(font_id, blf.SHADOW)
        blf.shadow(font_id, 0, 1.0, 0.2, 0.0, 1.0)
        blf.draw(font_id,str)
        linePosition -= height * 0.05
Ejemplo n.º 4
0
def test_read_file_no_file():
    file_name = 'none.txt'
    with pytest.raises(FileNotFoundError) as excinfo:
        parse_file.read_file(file_name)
    assert file_name in str(excinfo.value)
Ejemplo n.º 5
0
def run(input_file, output):
    commands = list(
        map(parse_file.parse_message, parse_file.read_file(input_file)))
    process_commands(commands, output)