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")
         ])
 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)
 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)
 def test_ratio_default(self):
     args = parse_args(["-t", get_test_file_path("mihalcea_tarau.txt")])
     self.assertEqual(DEFAULT_RATIO, args.ratio)
 def test_parse_fails_with_no_options(self):
     with self.assertRaises(SystemExit):
         parse_args([])
 def test_summary_mode_is_default(self):
     args = parse_args(["-t", get_test_file_path("mihalcea_tarau.txt")])
     self.assertEqual(SENTENCE, args.summary)
Example #7
0
 def test_summary_mode_is_default(self):
     args = parse_args(["-t", "some_text"])
     self.assertEqual(SENTENCE, args.summary)
 def test_parse_fails_with_no_text_option_keywords(self):
     with self.assertRaises(SystemExit):
         parse_args(["--keywords"])
Example #9
0
 def test_words_parameter_long(self):
     args = parse_args(["-t", "some_text", "--words", "200"])
     self.assertEqual(200, args.words)
Example #10
0
 def test_words_parameter_long(self):
     args = parse_args(["-t", "some_text", "--words", "200"])
     self.assertEqual(200, args.words)
Example #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)
Example #12
0
 def test_ratio_must_be_positive(self):
     with self.assertRaises(SystemExit):
         parse_args(["-t", "some_text", "-r", "-1.0"])
Example #13
0
 def test_ratio_must_be_less_than_1(self):
     with self.assertRaises(SystemExit):
         parse_args(["-t", "some_text", "-r", "1.1"])
Example #14
0
 def test_ratio_default(self):
     args = parse_args(["-t", "some_text"])
     self.assertEqual(DEFAULT_RATIO, args.ratio)
Example #15
0
 def test_keyword_mode(self):
     args = parse_args(["-t", "some_text", "-s", str(WORD)])
     self.assertEqual(WORD, args.summary)
Example #16
0
 def test_summary_mode_can_be_overriden(self):
     args = parse_args(["-t", "some_text", "-s", str(SENTENCE)])
     self.assertEqual(SENTENCE, args.summary)
Example #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"])
Example #18
0
 def test_parse_fails_with_no_text_option(self):
     with self.assertRaises(SystemExit):
         parse_args([])
Example #19
0
 def test_parse_text_short(self):
     args = parse_args(["-t", "some_text"])
     self.assertEqual("some_text", args.text)
Example #20
0
 def test_parse_text_short(self):
     args = parse_args(["-t", "some_text"])
     self.assertEqual("some_text", args.text)
Example #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)
Example #22
0
 def test_parse_fails_with_no_text_long(self):
     with self.assertRaises(SystemExit):
         parse_args(["--text"])
Example #23
0
 def test_parse_fails_with_no_text_option_summarize(self):
     with self.assertRaises(SystemExit):
         parse_args(["--summarize"])
Example #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))
Example #25
0
 def test_parse_text_long(self):
     args = parse_args(["--text", "some_text"])
     self.assertEqual("some_text", args.text)
Example #26
0
 def test_parse_text_long(self):
     args = parse_args(["--text", "some_text"])
     self.assertEqual("some_text", args.text)
Example #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))
Example #28
0
 def test_summary_mode_is_default(self):
     args = parse_args(["-t", "some_text"])
     self.assertEqual(SENTENCE, args.summary)
Example #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))
Example #30
0
 def test_summary_mode_can_be_overriden(self):
     args = parse_args(["-t", "some_text", "-s", str(SENTENCE)])
     self.assertEqual(SENTENCE, args.summary)
Example #31
0
 def test_keyword_mode(self):
     args = parse_args(["-t", "some_text", "-s", str(WORD)])
     self.assertEqual(WORD, args.summary)
Example #32
0
 def test_ratio_default(self):
     args = parse_args(["-t", "some_text"])
     self.assertEqual(DEFAULT_RATIO, args.ratio)
Example #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)
Example #34
0
 def test_ratio_must_be_positive(self):
     with self.assertRaises(SystemExit):
         parse_args(["-t", "some_text", "-r", "-1.0"])
Example #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"])
Example #36
0
 def test_ratio_must_be_less_than_1(self):
     with self.assertRaises(SystemExit):
         parse_args(["-t", "some_text", "-r", "1.1"])
Example #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)
Example #38
0
 def test_parse_fails_with_no_text_long(self):
     with self.assertRaises(SystemExit):
         parse_args(["--text"])