def test_keygen_with_mismatching_year(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.0,
                                                 mock_date(2010)),
                          title='Dogville #2 (2014)',
                          tokenizer=mock_tokens_function(
                              ['dogville']))
     self.assertEqual(12, scorer.score())
 def test_keygen_generic_comments(self):
     scorer = IssueScorer(metadata=mock_metadata(series='Dogville',
                                                 series_index=2.0,
                                                 comments='the barkening continues'),
                          title='Dogville #2',
                          tokenizer=mock_tokens_function(
                              ['dogville']))
     self.assertEqual(0, scorer.score())
Exemple #3
0
 def test_keygen_comments_indicating_collection(self):
     scorer = IssueScorer(metadata=mock_metadata(
         series='Dogville',
         series_index=2.0,
         comments='this collects issues #1-10'),
                          title='Dogville #2',
                          tokenizer=mock_tokens_function(['dogville']))
     self.assertEqual(20, scorer.score())
Exemple #4
0
 def test_keygen_generic_comments(self):
     scorer = IssueScorer(metadata=mock_metadata(
         series='Dogville',
         series_index=2.0,
         comments='the barkening continues'),
                          title='Dogville #2',
                          tokenizer=mock_tokens_function(['dogville']))
     self.assertEqual(0, scorer.score())
 def test_keygen_comments_indicating_translated_collection(self):
     scorer = IssueScorer(metadata=mock_metadata(series='Dogville',
                                                 series_index=2.0,
                                                 comments='Translates #1-10'),
                          title='Dogville #2',
                          tokenizer=mock_tokens_function(
                              ['dogville']))
     self.assertEqual(15, scorer.score())
def run_score_publish_date(title, publish_date):
    scorer = IssueScorer(metadata=mock_metadata(publish_date=publish_date),
                         title=title)
    return scorer.score_publish_date()
def run_score_title_tokens(series, tokens):
    scorer = IssueScorer(metadata=mock_metadata(series=series),
                         title='',
                         tokenizer=mock_tokens_function(tokens))
    return scorer.score_title_tokens()
def run_score_comments(comments):
    scorer = IssueScorer(metadata=mock_metadata(comments=comments))
    return scorer.score_comments()
def run_score_issue_number(title, series_index):
    scorer = IssueScorer(metadata=mock_metadata(series_index=series_index),
                         title=title)
    return scorer.score_issue_number()
Exemple #10
0
 def test_keygen_float_index_mismatch_int_title(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.1),
                          title='Dogville #2',
                          tokenizer=mock_tokens_function(['dogville']))
     self.assertEqual(50, scorer.score())
Exemple #11
0
def run_score_title_tokens(series, tokens):
    scorer = IssueScorer(metadata=mock_metadata(series=series),
                         title='',
                         tokenizer=mock_tokens_function(tokens))
    return scorer.score_title_tokens()
Exemple #12
0
 def test_keygen_no_title(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.0),
                          title=None,
                          tokenizer=mock_tokens_function([]))
     self.assertEqual(0, scorer.score())
Exemple #13
0
def run_score_issue_number(title, series_index):
    scorer = IssueScorer(metadata=mock_metadata(series_index=series_index),
                         title=title)
    return scorer.score_issue_number()
Exemple #14
0
 def test_keygen_issue_number_does_not_match_series_index(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.0),
                          title='Dogville #5',
                          tokenizer=mock_tokens_function(['dogville']))
     self.assertEqual(50, scorer.score())
Exemple #15
0
 def test_keygen_series_index_not_in_title(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.0),
                          title='Dogville',
                          tokenizer=mock_tokens_function(['dogville']))
     self.assertEqual(10, scorer.score())
Exemple #16
0
 def test_keygen_with_extra_tokens(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.0),
                          title='Dogville Awakening #2',
                          tokenizer=mock_tokens_function(
                              ['dogville', 'awakening']))
     self.assertEqual(21, scorer.score())
Exemple #17
0
 def test_keygen_with_missing_publish_date(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.0, None),
                          title='Dogville #2 (2014)',
                          tokenizer=mock_tokens_function(['dogville']))
     self.assertEqual(10, scorer.score())
Exemple #18
0
 def test_keygen_with_mismatching_year(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.0,
                                                 mock_date(2010)),
                          title='Dogville #2 (2014)',
                          tokenizer=mock_tokens_function(['dogville']))
     self.assertEqual(12, scorer.score())
 def test_keygen_float_series_index(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.1),
                          title='Dogville #2.1',
                          tokenizer=mock_tokens_function(
                              ['dogville']))
     self.assertEqual(0, scorer.score())
 def test_keygen_with_extra_tokens(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.0),
                          title='Dogville Awakening #2',
                          tokenizer=mock_tokens_function(
                              ['dogville', 'awakening']))
     self.assertEqual(21, scorer.score())
 def test_keygen_float_index_mismatch_int_title(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.1),
                          title='Dogville #2',
                          tokenizer=mock_tokens_function(
                              ['dogville']))
     self.assertEqual(50, scorer.score())
 def test_keygen_no_title(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.0),
                          title=None,
                          tokenizer=mock_tokens_function([]))
     self.assertEqual(0, scorer.score())
 def test_keygen_with_missing_publish_date(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.0, None),
                          title='Dogville #2 (2014)',
                          tokenizer=mock_tokens_function(
                              ['dogville']))
     self.assertEqual(10, scorer.score())
Exemple #24
0
 def test_keygen_float_series_index(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.1),
                          title='Dogville #2.1',
                          tokenizer=mock_tokens_function(['dogville']))
     self.assertEqual(0, scorer.score())
 def test_keygen_issue_number_does_not_match_series_index(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.0),
                          title='Dogville #5',
                          tokenizer=mock_tokens_function(
                              ['dogville']))
     self.assertEqual(50, scorer.score())
Exemple #26
0
def run_score_comments(comments):
    scorer = IssueScorer(metadata=mock_metadata(comments=comments))
    return scorer.score_comments()
 def test_keygen_series_index_not_in_title(self):
     scorer = IssueScorer(metadata=mock_metadata('Dogville', 2.0),
                          title='Dogville',
                          tokenizer=mock_tokens_function(
                              ['dogville']))
     self.assertEqual(10, scorer.score())
Exemple #28
0
def run_score_publish_date(title, publish_date):
    scorer = IssueScorer(metadata=mock_metadata(publish_date=publish_date),
                         title=title)
    return scorer.score_publish_date()