コード例 #1
0
def test_Text_clean_nwn(text_nwn):
    res = Text(text_nwn, 'nwn').clean
    assert res == "你好这是非词或word数字number测试"
コード例 #2
0
def test_Text_clean_whi(text_whi):
    res = Text(text_whi, 'whi').clean
    assert res == "你好,这是空白符号测试。"
コード例 #3
0
def test_Text_clean_nwh(text_nwh):
    res = Text(text_nwh, 'nwh').clean
    assert res == " \t\n"
コード例 #4
0
def test_Text_clean_chi(text_chi):
    res = Text(text_chi, 'chi').clean
    assert res == "。jefj*(&-1)!"
コード例 #5
0
def test_Text_clean_pun(text_pun):
    res = Text(text_pun, 'nwn').clean
    assert res == "你好这是标点符号测试"
コード例 #6
0
def test_Text_len_num(text_len):
    res = Text(text_len).len_num
    assert res == 3
コード例 #7
0
def test_Text_clean(get_patten):
    text = "这是,测试fdsf234*(&( 返回类型的文本。"
    res = Text(text, get_patten).clean
    assert isinstance(res, str) == True
コード例 #8
0
def test_Text_clean_pic(text_pic):
    res = Text(text_pic, 'pic').clean
    assert res == "你好,这#¥是图片测试。"
コード例 #9
0
def test_Text_extract_lnk(text_lnk):
    res = Text(text_lnk, 'lnk').extract
    assert "".join(res.mats) == "[link](https://yam.gift)http://yam.gift"
コード例 #10
0
def test_Text_clean_num(text_num):
    res = Text(text_num, 'num').clean
    assert res == "你好,这#¥是数字, , , , , , , , , 测试。"
コード例 #11
0
def test_Text_extract_pic(text_pic):
    res = Text(text_pic, 'pic').extract
    assert "".join(res.mats) == "![p1](https://xxx.jpeg)![](yyy.png)https://z.jpg"
コード例 #12
0
def test_Text_extract_num(text_num):
    res = Text(text_num, 'num').extract
    assert "".join(res.mats) == "2+2-22.1-2.21/52:3-2/52%2.5%"
コード例 #13
0
def test_Text_clean_eng(text_eng):
    res = Text(text_eng, 'eng').clean
    assert res == "你好,这#¥是英文测试。"
コード例 #14
0
def test_Text_extract_eng(text_eng):
    res = Text(text_eng, 'eng').extract
    assert "".join(res.mats) == "English"
コード例 #15
0
def test_Text_len_pun(text_len):
    res = Text(text_len).len_pun
    assert res == 14
コード例 #16
0
def test_Text_clean_lnk(text_lnk):
    res = Text(text_lnk, 'lnk').clean
    assert res == "你好,这#¥是链接测试。"
コード例 #17
0
def test_Text_len_eng(text_len):
    res = Text(text_len).len_eng
    assert res == 32
コード例 #18
0
def test_Text_extract_emj(text_emj):
    res = Text(text_emj, 'emj').extract
    assert "".join(res.mats) == "😁😜🌹"
コード例 #19
0
def test_Text_extract(get_patten):
    text = "这是,测试fdsf234*(&( 返回类型的文本。"
    res = Text(text, get_patten).extract
    assert isinstance(res, dict) == True
    assert isinstance(res.mats, list) == True
    assert isinstance(res.locs, list) == True
コード例 #20
0
def test_Text_clean_emj(text_emj):
    res = Text(text_emj, 'emj').clean
    assert res == "你好,这#¥是表情测试。"
コード例 #21
0
def test_Text_extract_chi(text_chi):
    res = Text(text_chi, 'chi').extract
    assert "".join(res.mats) == "你好这是中文测试"
コード例 #22
0
def test_Text_len_all(text_len):
    res = Text(text_len).len_all
    assert res == 64
コード例 #23
0
def test_Text_extract_pun(text_pun):
    res = Text(text_pun, 'nwn').extract
    assert "".join(res.mats) == ",,.!;<>()。"
コード例 #24
0
def test_Text_len_nwh(text_len):
    res = Text(text_len).len_nwh
    assert res == 63
コード例 #25
0
def test_Text_extract_whi(text_whi):
    res = Text(text_whi, 'whi').extract
    assert "".join(res.mats) == " \t\n"
コード例 #26
0
def test_Text_len_chi(text_len):
    res = Text(text_len).len_chi
    assert res == 6
コード例 #27
0
def test_Text_extract_nwh(text_nwh):
    res = Text(text_nwh, 'nwh').extract
    assert "".join(res.mats) == "你好,这是非空白符号测试。"
コード例 #28
0
def test_Text_len_wnb(text_len):
    res = Text(text_len).len_wnb
    assert res == 41
コード例 #29
0
def test_Text_extract_wnb(text_wnb):
    res = Text(text_wnb, 'wnb').extract
    assert "".join(res.mats) == "你好这是词与word数字number测试"
コード例 #30
0
def test_Text_extract_nwn(text_nwn):
    res = Text(text_nwn, 'nwn').extract
    assert "".join(res.mats) == ",。"