Ejemplo n.º 1
0
def test_simple_aggregate():
    doc = "This is a test job description."
    want = {
        "this": 1,
        "is": 1,
        "a": 1,
        "test": 1,
        "job": 1,
        "description": 1
    }
    got = aggregate(doc)
    assert want == got
def test_word_removal():
    doc = "This is a test job description, a description with a few words to remove."
    keywords = aggregate(doc)
    want = {
        'test': 1,
        'job': 1,
        'description': 2,
        'few': 1,
        'words': 1,
        'remove': 1
    }
    got = remove_words(keywords,
                       "ats_hacker/tests/test_data/words-to-remove.txt")
    assert want == got
Ejemplo n.º 3
0
def test_complex_aggregate():
    doc = "This is a test job. This is a test job description. This is" \
        " what I am testing."
    want = {
        "this": 3,
        "is": 3,
        "a": 2,
        "test": 2,
        "job": 2,
        "description": 1,
        "what": 1,
        "i": 1,
        "am": 1,
        "testing": 1
    }
    got = aggregate(doc)
    assert want == got
Ejemplo n.º 4
0
def test_aggregate_return_type():
    doc = "This is a test."
    got = aggregate(doc)
    assert isinstance(got, dict)
Ejemplo n.º 5
0
 def _process_document(self, document: str):
     self.document = document
     self.keyword_counts = aggregate(self.document)