Exemplo n.º 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])
Exemplo n.º 2
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])
Exemplo n.º 3
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)
Exemplo n.º 4
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)
Exemplo n.º 5
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)
Exemplo n.º 6
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)
Exemplo n.º 7
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,
         skipped=True)
Exemplo n.º 8
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(),
             None,
             False,
             [Fragment("test.tex", 1, 1, r"\input{foo}")]),
         self.test_case)
Exemplo n.º 9
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(),
             None,
             False,
             [Fragment("test.tex", 1, 1, r"\input{foo}")]),
         self.test_case)
Exemplo n.º 10
0
 def test_differs_from_an_equivalent_but_skipped_case(self):
     self.assertNotEqual(
         FlapTestCase(
             "foo",
             a_project().with_main_file("blabla").build(),
             a_project().with_merged_file("blabla").build(),
             None,
             True,
             [Fragment("test.tex", 1, 1, r"\input{foo}")]),
         self.test_case)
Exemplo n.º 11
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(),
            skipped=True)

        self.assertEqual(expected, test_case)
Exemplo n.º 12
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)
Exemplo n.º 13
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)
Exemplo n.º 14
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)
Exemplo n.º 15
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)
Exemplo n.º 16
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,
         None,
         False,
         self.output)
Exemplo n.º 17
0
    def test_parsing_a_test_case_with_invocation(self):
        yaml_file = self._create_file(YamlTest.that_includes_invocation("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(),
                        Invocation(tex_file="foo.tex"),
                        skipped=False)

        self.assertEqual(expected, test_case)
Exemplo n.º 18
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(),
                        None,
                        False,
                        [Fragment("main.tex", 1, 1, "\\input{result}")])

        self.assertEqual(expected, test_case)
Exemplo n.º 19
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)
Exemplo n.º 20
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)
Exemplo n.º 21
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)
Exemplo n.º 22
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)
Exemplo n.º 23
0
    def test_build_empty_project(self):
        project = a_project().build()

        self.assertEqual(LatexProject(), project)
Exemplo n.º 24
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)
Exemplo n.º 25
0
    def test_build_empty_project(self):
        project = a_project().build()

        self.assertEqual(LatexProject(), project)
Exemplo n.º 26
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)
Exemplo n.º 27
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)
Exemplo n.º 28
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)