38 lines
1.5 KiB
Python
38 lines
1.5 KiB
Python
"""Whitelist/blacklist and the SE keyword double filter."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from sebrief.sources import SOURCES, is_blacklisted, issns_for, looks_like_se
|
|
|
|
|
|
def test_issns_for_splits_plain_and_mega():
|
|
plain = issns_for(se_filter=False)
|
|
mega = issns_for(se_filter=True)
|
|
assert "1049-331X" in plain # TOSEM
|
|
assert "2169-3536" in mega # IEEE Access
|
|
assert set(plain).isdisjoint(mega)
|
|
assert len(plain) + len(mega) == sum(len(s.issns) for s in SOURCES)
|
|
|
|
|
|
def test_mdpi_blocked_by_issn_and_publisher():
|
|
assert is_blacklisted(["2079-9292"], None) is True # Electronics (MDPI)
|
|
assert is_blacklisted([], "MDPI AG") is True
|
|
assert is_blacklisted([], "MDPI") is True
|
|
assert is_blacklisted(["1049-331X"], "Association for Computing Machinery") is False
|
|
|
|
|
|
def test_extra_blacklist_issns():
|
|
assert is_blacklisted(["9999-0001"], None) is False
|
|
assert is_blacklisted(["9999-0001"], None, extra_issns=["9999-0001"]) is True
|
|
|
|
|
|
def test_looks_like_se_by_keyword_title_and_abstract():
|
|
assert looks_like_se("A Study on Automated Program Repair", "", []) is True
|
|
assert looks_like_se("Deep Models", "we improve defect prediction accuracy", []) is True
|
|
assert looks_like_se("Optimal Beamforming for 6G Networks", "channel estimation and MIMO", []) is False
|
|
|
|
|
|
def test_looks_like_se_by_topic_name():
|
|
assert looks_like_se("Untitled", "", ["Software Reliability and Analysis"]) is True
|
|
assert looks_like_se("Untitled", "", ["Wireless Communication"]) is False
|