Ejemplo n.º 1
0
 def test_simple_article(self):
     article_text = "{{REDaten}}text{{REAutor|Autor.}}"
     article = Article.from_text(article_text)
     self.assertEqual("text", article.text)
Ejemplo n.º 2
0
 def test_simple_article_with_whitespaces(self):
     article_text = "{{REDaten}}\n\n\t   text\t   {{REAutor|Autor.}}"
     article = Article.from_text(article_text)
     self.assertEqual("text", article.text)
Ejemplo n.º 3
0
 def test_bug_issue_number_deleted_from_author(self):
     article_text = "{{REAbschnitt}}\ntext\n{{REAutor|Some Author.|I,1}}"
     article = Article.from_text(article_text)
     compare("I,1", article.author[1])
     self.assertIn("{{REAutor|Some Author.|I,1}}", article.to_text())
Ejemplo n.º 4
0
 def test_bug_issue_OFF_deleted_from_author_no_OFF(self):
     article_text = "{{REAbschnitt}}\ntext\n{{REAutor|A. Author.}}"
     article = Article.from_text(article_text)
     self.assertIn("{{REAutor|A. Author.}}", article.to_text())
Ejemplo n.º 5
0
 def test_bug_shortened_parameter(self):
     article_text = "{{REDaten\n|GEBURTS=1900\n}}\ntest.\n{{REAutor|Author.}}"
     article = Article.from_text(article_text)
     self.assertEqual("1900", article["GEBURTSJAHR"].value)
Ejemplo n.º 6
0
 def test_bug_dot_added_to_author(self):
     article_text = "{{REAbschnitt}}\ntext\n{{REAutor|S.A.†}}"
     article = Article.from_text(article_text)
     self.assertIn("{{REAutor|S.A.†}}", article.to_text())
Ejemplo n.º 7
0
 def test_from_text_bug_bad_whitespace(self):
     article_text = "{{REDaten \n|BAND=I,1}}\ntext\n{{REAutor|Some Author.}}"
     article = Article.from_text(article_text)
     self.assertEqual(article.article_type, "REDaten")
Ejemplo n.º 8
0
 def test_correct_case(self):
     article_text = "{{REDaten\n|Nachtrag=OFF|Ksch=OFF\n}}\ntext\n{{REAutor|Autor.}}"
     article = Article.from_text(article_text)
     self.assertEqual(ARTICLE_TEMPLATE, article.to_text())
Ejemplo n.º 9
0
 def test_from_text_REAbschnitt(self):
     article_text = "{{REAbschnitt}}\ntext\n{{REAutor|Some Author.}}"
     article = Article.from_text(article_text)
     self.assertEqual(article.article_type, "REAbschnitt")
Ejemplo n.º 10
0
 def test_from_text_text_after_article(self):
     article_text = "{{REDaten}}text{{REAutor}}text"
     with self.assertRaisesRegex(
             ReDatenException, "Article has the wrong structure. "
             "There is text after the article."):
         Article.from_text(article_text)
Ejemplo n.º 11
0
 def test_complete_article(self):
     article_text = ARTICLE_TEMPLATE
     Article.from_text(article_text)
Ejemplo n.º 12
0
 def test_from_text_wrong_order_of_templates(self):
     article_text = "{{REAutor}}{{REDaten}}\ntext"
     with self.assertRaisesRegex(
             ReDatenException,
             "Article has the wrong structure. Wrong order of templates."):
         Article.from_text(article_text)
Ejemplo n.º 13
0
 def test_from_text_no_REAuthor_templates(self):
     article_text = "{{REDaten}}\ntext\n"
     with self.assertRaisesRegex(
             ReDatenException, "Article has the wrong structure. "
             "There must one stop template"):
         Article.from_text(article_text)
Ejemplo n.º 14
0
 def test_from_text_wrong_property_in_REDaten(self):
     article_text = "{{REDaten\n|III\n|SPALTE_START=1\n}}\ntext\n{{REAutor|Some Author.}}"
     with self.assertRaisesRegex(
             ReDatenException,
             "REDaten has property without a key word. --> {.*?}"):
         Article.from_text(article_text)
Ejemplo n.º 15
0
 def test_from_text_wrong_keywords(self):
     article_text = "{{REDaten|WHATEVER=I}}" \
                    "\ntext\n{{REAutor|Some Author.}}"
     with self.assertRaisesRegex(ReDatenException,
                                 "REDaten has wrong key word. --> {.*?}"):
         Article.from_text(article_text)