예제 #1
0
def test_token_assign_name():
    t = Token('hello', b'world')
    t.name = 'test'
예제 #2
0
def test_token_assign_text():
    t = Token('hello', b'world')
    t.text = 'test'
예제 #3
0
def test_token_assign_text():
    t = Token('hello', b'world')
    t.text = 'test'
예제 #4
0
def test_token_assign_other():
    t = Token('hello', b'world')
    t.blabla = 'test'
예제 #5
0
def test_invalid_token():
    lexer = LatexIncrementalDecoder()
    # piggyback an implementation which results in invalid tokens
    lexer.get_raw_tokens = lambda bytes_, final: [Token('**invalid**', bytes_)]
    with pytest.raises(AssertionError):
        lexer.decode(b'hello')
예제 #6
0
def invalid_token_test():
    lexer = LatexIncrementalDecoder()
    # piggyback an implementation which results in invalid tokens
    lexer.get_raw_tokens = lambda bytes_, final: [Token('**invalid**', bytes_)]
    nose.tools.assert_raises(AssertionError, lambda: lexer.decode(b'hello'))
예제 #7
0
def test_token_assign_other():
    t = Token()
    t.blabla = 'test'
예제 #8
0
def test_token_assign_text():
    t = Token()
    t.text = 'test'
예제 #9
0
def test_token_assign_name():
    t = Token()
    t.name = 'test'
예제 #10
0
def test_token_assign_text():
    t = Token()
    t.text = 'test'
예제 #11
0
def test_token_create():
    t = Token()
    nose.tools.assert_equal(t.name, 'unknown')
    nose.tools.assert_equal(t.text, b'')
예제 #12
0
def test_token_assign_other():
    with pytest.raises(AttributeError):
        t = Token('hello', u'world')
        t.blabla = 'test'
예제 #13
0
def test_token_assign_text():
    with pytest.raises(AttributeError):
        t = Token('hello', u'world')
        t.text = 'test'
예제 #14
0
def test_token_assign_other():
    t = Token('hello', b'world')
    t.blabla = 'test'
예제 #15
0
def test_token_create_with_args():
    t = Token('hello', b'world')
    nose.tools.assert_equal(t.name, 'hello')
    nose.tools.assert_equal(t.text, b'world')
예제 #16
0
def test_token_assign_name():
    t = Token()
    t.name = 'test'
예제 #17
0
def test_token_assign_name():
    t = Token('hello', b'world')
    t.name = 'test'
예제 #18
0
def test_token_assign_other():
    t = Token()
    t.blabla = 'test'
예제 #19
0
def test_token_create_with_args():
    t = Token('hello', u'world')
    assert t.name == 'hello'
    assert t.text == u'world'