コード例 #1
0
ファイル: test_parser.py プロジェクト: kanghaiyang/blaze
def test_parse_blob_varchar():
    p1 = parse('2, 3, Varchar(5)')
    p2 = parse('2, 3, blob')

    assert type(p1[2]) is Varchar
    assert type(p2[2]) is Blob

    # Deconstructing the type
    assert p1[2].maxlen == 5
コード例 #2
0
ファイル: test_parser.py プロジェクト: kanghaiyang/blaze
def test_simple_parse():
    x = parse('Enum(1,2)')
    y = parse('300 , 400, {x: int64, y: int32}')

    assert type(x) is DataShape
    assert type(y) is DataShape

    assert type(y[0]) is Fixed
    assert type(y[1]) is Fixed
    assert type(y[2]) is Record

    rec = y[2]

    assert rec['x'] is int64
    assert rec['y'] is int32
コード例 #3
0
ファイル: test_parser.py プロジェクト: dlbrittain/blaze-core
def test_simple_parse():
    x = parse("2, 3, int32")
    y = parse("300 , 400, {x: int64, y: int32}")

    assert type(x) is DataShape
    assert type(y) is DataShape

    assert type(y[0]) is Fixed
    assert type(y[1]) is Fixed
    assert type(y[2]) is Record

    rec = y[2]

    assert rec["x"] is int64
    assert rec["y"] is int32
コード例 #4
0
ファイル: test_parser.py プロジェクト: kanghaiyang/blaze
def test_parse_string():
    p1 = parse('2, 3, String(5)')

    assert type(p1[2]) is String

    # Deconstructing the type
    assert p1[2].fixlen == 5
コード例 #5
0
ファイル: test_parser.py プロジェクト: kanghaiyang/blaze
def test_flatten2():
    x = parse('a, ( b, ( c, d ) )')
    y = parse('a, b, c, d')

    assert len(x.parameters) == len(y.parameters)

    assert x[0].symbol == 'a'
    assert x[1].symbol == 'b'
    assert x[2].symbol == 'c'
    assert x[3].symbol == 'd'

    assert y[0].symbol == 'a'
    assert y[1].symbol == 'b'
    assert y[2].symbol == 'c'
    assert y[3].symbol == 'd'

    assert x.parameters == y.parameters
コード例 #6
0
ファイル: test_parser.py プロジェクト: garfee/blaze
def test_flatten2():
    x = parse('a, ( b, ( c, d ) )')
    y = parse('a, b, c, d')

    assert len(x.parameters) == len(y.parameters)

    assert x[0].symbol == 'a'
    assert x[1].symbol == 'b'
    assert x[2].symbol == 'c'
    assert x[3].symbol == 'd'

    assert y[0].symbol == 'a'
    assert y[1].symbol == 'b'
    assert y[2].symbol == 'c'
    assert y[3].symbol == 'd'

    assert x.parameters == y.parameters
コード例 #7
0
ファイル: test_parser.py プロジェクト: kanghaiyang/blaze
def test_free_variables():
    p = parse('N, M, 800, 600, int32')

    assert type(p[0]) is TypeVar
    assert type(p[1]) is TypeVar
    assert type(p[2]) is Fixed
    assert type(p[3]) is Fixed
    assert type(p[4]) is CType
コード例 #8
0
ファイル: test_parser.py プロジェクト: dlbrittain/blaze-core
def test_flatten2():
    x = parse("a, ( b, ( c, d ) )")
    y = parse("a, b, c, d")

    assert len(x.parameters) == len(y.parameters)

    assert x[0].symbol == "a"
    assert x[1].symbol == "b"
    assert x[2].symbol == "c"
    assert x[3].symbol == "d"

    assert y[0].symbol == "a"
    assert y[1].symbol == "b"
    assert y[2].symbol == "c"
    assert y[3].symbol == "d"

    assert _reduce(x) == _reduce(y)
コード例 #9
0
ファイル: test_parser.py プロジェクト: garfee/blaze
def test_simple_parse():
    x = parse('800, 600, RGBA')
    y = parse('Enum (1,2)')
    z = parse('300 , 400, Record(x=int64, y=int32)')

    assert type(x) is DataShape
    assert type(y) is DataShape
    assert type(z) is DataShape

    assert type(x[0]) is Fixed
    assert type(y[0]) is Enum

    assert type(z[0]) is Fixed
    assert type(z[1]) is Fixed
    assert type(z[2]) is Record

    assert z[2]('x') is int64
    assert z[2]('y') is int32
コード例 #10
0
ファイル: test_parser.py プロジェクト: garfee/blaze
def test_flat_datashape():
    p = parse('N, M, 800, 600, (int16, int16, int16, int8)')

    assert type(p[0]) is TypeVar
    assert type(p[1]) is TypeVar
    assert type(p[2]) is Fixed
    assert type(p[3]) is Fixed

    assert p[4:8] == (int16, int16, int16, int8)
コード例 #11
0
ファイル: test_parser.py プロジェクト: kanghaiyang/blaze
def test_flat_datashape():
    p = parse('N, M, 800, 600, (int16, int16, int16, int8)')

    assert type(p[0]) is TypeVar
    assert type(p[1]) is TypeVar
    assert type(p[2]) is Fixed
    assert type(p[3]) is Fixed

    assert p[4:8] == (int16, int16, int16, int8)
コード例 #12
0
ファイル: test_parser.py プロジェクト: atbrox/blaze
def test_simple_parse():
    x = parse('800, 600, RGBA')
    y = parse('Enum (1,2)')
    z = parse('300 , 400, Record(x=int64, y=int32)')

    assert type(x) is DataShape
    assert type(y) is DataShape
    assert type(z) is DataShape

    assert type(x[0]) is Fixed
    assert type(y[0]) is Enum

    assert type(z[0]) is Fixed
    assert type(z[1]) is Fixed
    assert type(z[2]) is Record

    assert z[2]('x') is int64
    assert z[2]('y') is int32
コード例 #13
0
ファイル: test_parser.py プロジェクト: atbrox/blaze
def test_free_variables():
    p = parse('N, M, 800, 600, RGBA')

    assert type(p[0]) is TypeVar
    assert type(p[1]) is TypeVar
    assert type(p[2]) is Fixed
    assert type(p[3]) is Fixed
    assert type(p[4]) is Record
    assert p[4]('R') is int16
    assert p[4]('G') is int16
    assert p[4]('B') is int16
    assert p[4]('A') is int8
コード例 #14
0
ファイル: test_parser.py プロジェクト: garfee/blaze
def test_free_variables():
    p = parse('N, M, 800, 600, RGBA')

    assert type(p[0]) is TypeVar
    assert type(p[1]) is TypeVar
    assert type(p[2]) is Fixed
    assert type(p[3]) is Fixed
    assert type(p[4]) is Record
    assert p[4]('R') is int16
    assert p[4]('G') is int16
    assert p[4]('B') is int16
    assert p[4]('A') is int8
コード例 #15
0
ファイル: test_parser.py プロジェクト: kanghaiyang/blaze
def test_parse_either():
    x = parse('Either(int64, NA)')
    assert x[0].a == int64
    assert x[0].b is na
コード例 #16
0
ファイル: test_parser.py プロジェクト: kanghaiyang/blaze
def test_parse_na():
    x = parse('NA')
    assert x[0] is na
コード例 #17
0
ファイル: test_parser.py プロジェクト: kanghaiyang/blaze
def test_parse_vars():
    x = parse('Range(1,2)')

    assert x[0].lower == 1
    assert x[0].upper == 2
コード例 #18
0
ファイル: test_parser.py プロジェクト: kanghaiyang/blaze
def test_parse_ctypes():
    x = parse('800, 600, double')
    y = parse('800, 600, PyObject')
コード例 #19
0
ファイル: test_parser.py プロジェクト: garfee/blaze
def test_parse_equality():
    x = parse('800, 600, int64')
    y = parse('800, 600, int64')

    assert x._equal(y)
コード例 #20
0
ファイル: test_parser.py プロジェクト: kanghaiyang/blaze
def test_compound_record1():
    p = parse('6, {x:int, y:float, z:str}')

    assert type(p[0]) is Fixed
    assert type(p[1]) is Record
コード例 #21
0
ファイル: test_parser.py プロジェクト: garfee/blaze
def test_parse_na():
    x = parse('NA')
    assert x[0] is na
コード例 #22
0
ファイル: test_parser.py プロジェクト: dlbrittain/blaze-core
def test_parse_na():
    x = parse("NA")
    assert x[0] is na
コード例 #23
0
ファイル: test_parser.py プロジェクト: dlbrittain/blaze-core
def test_parse_ctypes():
    x = parse("800, 600, double")
    y = parse("800, 600, PyObject")
コード例 #24
0
ファイル: magic.py プロジェクト: renjiec/blaze-core
 def blaze(self, line, cell):
     return parse(str(cell))
コード例 #25
0
ファイル: test_parser.py プロジェクト: garfee/blaze
def test_parse_vars():
    x = parse('Range(1,2)')

    assert x[0].lower == 1
    assert x[0].upper == 2
コード例 #26
0
ファイル: test_parser.py プロジェクト: garfee/blaze
def test_parse_either():
    x = parse('Either(int64, NA)')
    assert x[0].a == int64
    assert x[0].b is na
コード例 #27
0
ファイル: test_parser.py プロジェクト: kanghaiyang/blaze
def test_compound_record2():
    p = parse('{ a: { x: int, y: int }, b: {w: int, u: int } }')

    assert type(p[0]) is Record
コード例 #28
0
ファイル: test_parser.py プロジェクト: kanghaiyang/blaze
def test_parse_equality():
    x = parse('800, 600, int64')
    y = parse('800, 600, int64')

    assert x._equal(y)
コード例 #29
0
ファイル: test_parser.py プロジェクト: garfee/blaze
def test_parse_ctypes():
    x = parse('800, 600, double')
    y = parse('800, 600, PyObject')
コード例 #30
0
ファイル: test_parser.py プロジェクト: garfee/blaze
def test_compound_record():
    p = parse('6, Record(x=int, y=float, z=str)')
    assert type(p[0]) is Fixed
    assert type(p[1]) is Record
コード例 #31
0
ファイル: test_parser.py プロジェクト: dlbrittain/blaze-core
def test_parse_equality():
    x = parse("800, 600, int64")
    y = parse("800, 600, int64")

    assert x._equal(y)
コード例 #32
0
ファイル: test_parser.py プロジェクト: atbrox/blaze
def test_compound_record():
    p = parse('6, Record(x=int, y=float, z=str)')
    assert type(p[0]) is Fixed
    assert type(p[1]) is Record
コード例 #33
0
ファイル: test_parser.py プロジェクト: kanghaiyang/blaze
def test_parse_fixed_integer_diff():
    x = parse('1, int32')
    y = parse('{1}, int32')

    assert type(x[0]) is Fixed
    assert type(y[0][0]) is Integer
コード例 #34
0
ファイル: test_parser.py プロジェクト: garfee/blaze
def test_parse_fixed_integer_diff():
    x = parse('1, int32')
    y = parse('{1}, int32')

    assert type(x[0]) is Fixed
    assert type(y[0][0]) is Integer