Ejemplo n.º 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")
         ])
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 4
0
 def test_ratio_default(self):
     args = parse_args(["-t", get_test_file_path("mihalcea_tarau.txt")])
     self.assertEqual(DEFAULT_RATIO, args.ratio)
Ejemplo n.º 5
0
 def test_parse_fails_with_no_options(self):
     with self.assertRaises(SystemExit):
         parse_args([])
Ejemplo n.º 6
0
 def test_summary_mode_is_default(self):
     args = parse_args(["-t", get_test_file_path("mihalcea_tarau.txt")])
     self.assertEqual(SENTENCE, args.summary)
Ejemplo n.º 7
0
 def test_summary_mode_is_default(self):
     args = parse_args(["-t", "some_text"])
     self.assertEqual(SENTENCE, args.summary)
Ejemplo n.º 8
0
 def test_parse_fails_with_no_text_option_keywords(self):
     with self.assertRaises(SystemExit):
         parse_args(["--keywords"])
Ejemplo n.º 9
0
 def test_words_parameter_long(self):
     args = parse_args(["-t", "some_text", "--words", "200"])
     self.assertEqual(200, args.words)
Ejemplo n.º 10
0
 def test_words_parameter_long(self):
     args = parse_args(["-t", "some_text", "--words", "200"])
     self.assertEqual(200, args.words)
Ejemplo n.º 11
0
 def test_additional_stopwords_long(self):
     args = parse_args(["-t", "some_text", "--additional_stopwords", "uno dos tres catorce"])
     self.assertEqual("uno dos tres catorce", args.additional_stopwords)
Ejemplo n.º 12
0
 def test_ratio_must_be_positive(self):
     with self.assertRaises(SystemExit):
         parse_args(["-t", "some_text", "-r", "-1.0"])
Ejemplo n.º 13
0
 def test_ratio_must_be_less_than_1(self):
     with self.assertRaises(SystemExit):
         parse_args(["-t", "some_text", "-r", "1.1"])
Ejemplo n.º 14
0
 def test_ratio_default(self):
     args = parse_args(["-t", "some_text"])
     self.assertEqual(DEFAULT_RATIO, args.ratio)
Ejemplo n.º 15
0
 def test_keyword_mode(self):
     args = parse_args(["-t", "some_text", "-s", str(WORD)])
     self.assertEqual(WORD, args.summary)
Ejemplo n.º 16
0
 def test_summary_mode_can_be_overriden(self):
     args = parse_args(["-t", "some_text", "-s", str(SENTENCE)])
     self.assertEqual(SENTENCE, args.summary)
Ejemplo n.º 17
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"])
Ejemplo n.º 18
0
 def test_parse_fails_with_no_text_option(self):
     with self.assertRaises(SystemExit):
         parse_args([])
Ejemplo n.º 19
0
 def test_parse_text_short(self):
     args = parse_args(["-t", "some_text"])
     self.assertEqual("some_text", args.text)
Ejemplo n.º 20
0
 def test_parse_text_short(self):
     args = parse_args(["-t", "some_text"])
     self.assertEqual("some_text", args.text)
Ejemplo n.º 21
0
 def test_additional_stopwords_long(self):
     args = parse_args([
         "-t", "some_text", "--additional_stopwords", "uno dos tres catorce"
     ])
     self.assertEqual("uno dos tres catorce", args.additional_stopwords)
Ejemplo n.º 22
0
 def test_parse_fails_with_no_text_long(self):
     with self.assertRaises(SystemExit):
         parse_args(["--text"])
Ejemplo n.º 23
0
 def test_parse_fails_with_no_text_option_summarize(self):
     with self.assertRaises(SystemExit):
         parse_args(["--summarize"])
Ejemplo n.º 24
0
 def test_parse_text_keywords(self):
     args = parse_args(
         ["--keywords",
          get_test_file_path("mihalcea_tarau.txt")])
     self.assertTrue(isinstance(args.keywords, str))
Ejemplo n.º 25
0
 def test_parse_text_long(self):
     args = parse_args(["--text", "some_text"])
     self.assertEqual("some_text", args.text)
Ejemplo n.º 26
0
 def test_parse_text_long(self):
     args = parse_args(["--text", "some_text"])
     self.assertEqual("some_text", args.text)
Ejemplo n.º 27
0
 def test_parse_text_summarize(self):
     args = parse_args(
         ["--summarize",
          get_test_file_path("mihalcea_tarau.txt")])
     self.assertTrue(isinstance(args.summarize, str))
Ejemplo n.º 28
0
 def test_summary_mode_is_default(self):
     args = parse_args(["-t", "some_text"])
     self.assertEqual(SENTENCE, args.summary)
Ejemplo n.º 29
0
 def test_parse_text_long(self):
     args = parse_args(["--text", get_test_file_path("mihalcea_tarau.txt")])
     self.assertTrue(isinstance(args.text, str))
Ejemplo n.º 30
0
 def test_summary_mode_can_be_overriden(self):
     args = parse_args(["-t", "some_text", "-s", str(SENTENCE)])
     self.assertEqual(SENTENCE, args.summary)
Ejemplo n.º 31
0
 def test_keyword_mode(self):
     args = parse_args(["-t", "some_text", "-s", str(WORD)])
     self.assertEqual(WORD, args.summary)
Ejemplo n.º 32
0
 def test_ratio_default(self):
     args = parse_args(["-t", "some_text"])
     self.assertEqual(DEFAULT_RATIO, args.ratio)
Ejemplo n.º 33
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)
Ejemplo n.º 34
0
 def test_ratio_must_be_positive(self):
     with self.assertRaises(SystemExit):
         parse_args(["-t", "some_text", "-r", "-1.0"])
Ejemplo n.º 35
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"])
Ejemplo n.º 36
0
 def test_ratio_must_be_less_than_1(self):
     with self.assertRaises(SystemExit):
         parse_args(["-t", "some_text", "-r", "1.1"])
Ejemplo n.º 37
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)
Ejemplo n.º 38
0
 def test_parse_fails_with_no_text_long(self):
     with self.assertRaises(SystemExit):
         parse_args(["--text"])