Пример #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'