Beispiel #1
0
 def _verify(self, test_cases):
     self.assertEqual(1, len(test_cases))
     expected = FlapTestCase(
         "test 1",
         a_project().with_main_file(self.LATEX_CODE).build(),
         a_project().with_merged_file(self.LATEX_CODE).build())
     self.assertEqual(expected, test_cases[0])
Beispiel #2
0
 def test_differs_from_an_equivalent_but_with_different_output(self):
     self.assertNotEqual(
         FlapTestCase(
             "foo",
             a_project().with_main_file("blabla").build(),
             a_project().with_merged_file("blabla").build(),
             output=[Fragment("test.tex", 123, 0, r"\input{foo}")]),
         self.test_case)
Beispiel #3
0
 def test_differs_from_a_project_with_another_expectation(self):
     self.assertNotEqual(
         FlapTestCase(
             "foo",
             a_project().with_main_file("blabla").build(),
             a_project().with_merged_file("something different").build(),
             False,
             [Fragment("test.tex", 1, 1, r"\input{foo}")]),
         self.test_case)
Beispiel #4
0
 def test_equals_a_similar_test_case(self):
     self.assertEqual(
         FlapTestCase(
             "foo",
             a_project().with_main_file("blabla").build(),
             a_project().with_merged_file("blabla").build(),
             False,
             [Fragment("test.tex", 1, 1, r"\input{foo}")]),
         self.test_case)
Beispiel #5
0
    def test_loading_test_case_with_latex_code(self):
        yaml_file = self._create_file(YamlTest.with_latex_code())

        test_case = self._read_test_case_from(yaml_file)

        expected = FlapTestCase(
                        "test 1",
                        a_project().with_main_file("\\documentclass{article}\n\\begin{document}\n  This is a simple \\LaTeX document!\n\\end{document}").build(),
                        a_project().with_merged_file("\\documentclass{article}\n\\begin{document}\n  This is a simple \\LaTeX document!\n\\end{document}").build())

        self.assertEqual(expected, test_case)
Beispiel #6
0
    def test_parsing_a_skipped_yaml_code(self):
        yaml_file = self._create_file(YamlTest.that_is_skipped("Test 1"))
        test_case = self._read_test_case_from(yaml_file)

        expected = FlapTestCase(
                        "Test 1",
                        a_project().with_main_file("blabla").build(),
                        a_project().with_merged_file("blabla").build(),
                        True)

        self.assertEqual(expected, test_case)
Beispiel #7
0
    def test_parsing_a_test_case_with_expected_outputs(self):
        yaml_file = self._create_file(YamlTest.that_includes_expected_outputs("Test 1"))
        test_case = self._read_test_case_from(yaml_file)

        expected = FlapTestCase(
                        "Test 1",
                        a_project().with_main_file("blabla").build(),
                        a_project().with_merged_file("blabla").build(),
                        False,
                        [Fragment("main.tex", 1, 1, "\\input{result}")])

        self.assertEqual(expected, test_case)
Beispiel #8
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)
Beispiel #9
0
 def setUp(self):
     self.project = a_project().with_main_file("blabla").build()
     self.expected = a_project().with_merged_file("blabla").build()
     self.test_case_name = "foo"
     self.output = [Fragment("test.tex", 1, 1, r"\input{foo}")]
     self.test_case = FlapTestCase(self.test_case_name, self.project, self.expected, False, self.output)
Beispiel #10
0
 def setUp(self):
     self.project = a_project().with_main_file("blabla").build()
     self.expected = a_project().with_merged_file("blabla").build()
     self.test_case_name = "foo"
     self.test_case = FlapTestCase(self.test_case_name, self.project, self.expected, True)
Beispiel #11
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)
Beispiel #12
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)
Beispiel #13
0
    def test_build_empty_project(self):
        project = a_project().build()

        self.assertEqual(LatexProject(), project)