Пример #1
0
 def test_parse_fails_if_multiple_modes_selected(self):
     with self.assertRaises(SystemExit):
         parse_args([
             "--summarize",
             get_test_file_path("mihalcea_tarau.txt"), "-t",
             get_test_file_path("mihalcea_tarau.txt")
         ])
Пример #2
0
 def test_summary_mode_can_be_overriden(self):
     args = parse_args([
         "-t",
         get_test_file_path("mihalcea_tarau.txt"), "-s",
         str(SENTENCE)
     ])
     self.assertEqual(SENTENCE, args.summary)
Пример #3
0
 def test_additional_stopwords_long(self):
     args = parse_args([
         "-t",
         get_test_file_path("mihalcea_tarau.txt"), "--additional_stopwords",
         "uno dos tres catorce"
     ])
     self.assertEqual("uno dos tres catorce", args.additional_stopwords)
Пример #4
0
 def test_words_parameter_short(self):
     args = parse_args(
         ["-t", get_test_file_path("mihalcea_tarau.txt"), "-w", "200"])
     self.assertEqual(200, args.words)
Пример #5
0
 def test_ratio_must_be_less_than_1(self):
     with self.assertRaises(SystemExit):
         parse_args(
             ["-t",
              get_test_file_path("mihalcea_tarau.txt"), "-r", "1.1"])
Пример #6
0
 def test_ratio_must_be_positive(self):
     with self.assertRaises(SystemExit):
         parse_args(
             ["-t",
              get_test_file_path("mihalcea_tarau.txt"), "-r", "-1.0"])
Пример #7
0
 def test_ratio_default(self):
     args = parse_args(["-t", get_test_file_path("mihalcea_tarau.txt")])
     self.assertEqual(DEFAULT_RATIO, args.ratio)
Пример #8
0
 def test_keyword_mode(self):
     args = parse_args(
         ["-t",
          get_test_file_path("mihalcea_tarau.txt"), "-s",
          str(WORD)])
     self.assertEqual(WORD, args.summary)
Пример #9
0
 def test_summary_mode_is_default(self):
     args = parse_args(["-t", get_test_file_path("mihalcea_tarau.txt")])
     self.assertEqual(SENTENCE, args.summary)
Пример #10
0
 def test_parse_text_long(self):
     args = parse_args(["--text", get_test_file_path("mihalcea_tarau.txt")])
     self.assertTrue(isinstance(args.text, str))
Пример #11
0
 def test_parse_text_keywords(self):
     args = parse_args(
         ["--keywords",
          get_test_file_path("mihalcea_tarau.txt")])
     self.assertTrue(isinstance(args.keywords, str))
Пример #12
0
 def test_parse_text_summarize(self):
     args = parse_args(
         ["--summarize",
          get_test_file_path("mihalcea_tarau.txt")])
     self.assertTrue(isinstance(args.summarize, str))