Exemple #1
0
 def test_build_a_merged_file_project(self):
     project = a_project()\
         .with_merged_file("foo")\
         .build()
     self.assertEqual(
         LatexProject(TexFile(LatexProjectBuilder.MERGED_FILE, "foo")),
         project)
Exemple #2
0
 def test_build_project_with_image(self):
     project = a_project()\
         .with_image("img/result.pdf")\
         .build()
     self.assertEqual(
         LatexProject(
             TexFile(
                 "img/result.pdf",
                 LatexProjectBuilder.IMAGE_CONTENT.format(
                     key="img_result.pdf"))), project)
Exemple #3
0
    def test_difference_with_a_project_with_an_extra_file(self):
        try:
            extra_file = TexFile("extra/file.tex", "Extra blabla")
            self.tex.assert_is_equivalent_to(
                LatexProject(self.file, extra_file))
            self.fail("Exception expected")

        except AssertionError as error:
            self.assertEqual(
                LatexProject.UNEXPECTED_FILE.format(file=extra_file.path),
                str(error))
Exemple #4
0
    def test_difference_with_a_project_whose_file_content_differs(self):
        try:
            content = "something different"
            self.tex.assert_is_equivalent_to(
                LatexProject(TexFile("main.tex", content)))
            self.fail("Exception expected")

        except AssertionError as error:
            self.assertEqual(
                LatexProject.CONTENT_MISMATCH.format(file="main.tex",
                                                     actual=content,
                                                     expected="blabla"),
                str(error))
Exemple #5
0
 def test_differ_when_file_path_differ(self):
     self.assertNotEqual(
         LatexProject(TexFile("a/different/path.tex", "blabla")), self.tex)
Exemple #6
0
 def test_differ_when_file_content_differ(self):
     self.assertNotEqual(
         LatexProject(TexFile("main.tex", "THIS IS DIFFERENT!")), self.tex)
Exemple #7
0
 def test_equals_a_project_with_similar_files(self):
     self.assertEqual(LatexProject(TexFile("main.tex", "blabla")), self.tex)
Exemple #8
0
 def setUp(self):
     self.file = TexFile("main.tex", "blabla")
     self.tex = LatexProject(self.file)
Exemple #9
0
 def test_does_not_equals_tex_file_with_a_different_content(self):
     self.assertNotEqual(TexFile(self.path, self.content + "blablabla"),
                         self.tex_file)
Exemple #10
0
 def test_setup_a_two_files_project(self):
     self._do_test_setup(
         LatexProject(TexFile("main.tex", "blabla"),
                      TexFile("result.tex", "Some results")))
Exemple #11
0
 def test_equals_a_similar_file(self):
     self.assertEqual(TexFile("test/main.tex", "foo"), self.tex_file)
Exemple #12
0
 def setUp(self):
     self.path = "test/main.tex"
     self.content = "foo"
     self.tex_file = TexFile(self.path, self.content)
Exemple #13
0
 def test_build_single_file_projects(self):
     project = a_project()\
         .with_file("main.tex", "foo")\
         .build()
     self.assertEqual(LatexProject(TexFile("main.tex", "foo")), project)
Exemple #14
0
 def _expected(self):
     tex_files = []
     for (path, content) in self._files:
         tex_files.append(TexFile(path, content))
     return LatexProject(*tex_files)
Exemple #15
0
 def test_setup_a_project_with_subdirectories(self):
     self._do_test_setup(
         LatexProject(TexFile("main.tex", "blabla"),
                      TexFile("sections/introduction.tex", "introduction"),
                      TexFile("sections/conclusions.tex", "conclusions"),
                      TexFile("images/results.pdf", "PDF")))
Exemple #16
0
 def test_does_not_equals_tex_file_with_a_different_path(self):
     self.assertNotEqual(TexFile("dir/" + self.path, self.content),
                         self.tex_file)
Exemple #17
0
 def _extract_tex_file(self, entry):
     return TexFile(self._extract_path(entry), self._extract_content(entry))
Exemple #18
0
 def test_setup_a_single_file_project(self):
     self._do_test_setup(LatexProject(TexFile("main.tex", "blabla")))