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])
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
def test_build_empty_project(self): project = a_project().build() self.assertEqual(LatexProject(), project)
def test_build_single_file_projects(self): project = a_project()\ .with_file("main.tex", "foo")\ .build() self.assertEqual(LatexProject(TexFile("main.tex", "foo")), project)
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)
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)