Exemple #1
0
def test_MloxRuleManager_report_emptyFile_withSectionsFlag(capsys):
    testfile_path = os.path.join(testfile_dir, "empty.txt")
    cli.main(args=["report", "--sections", testfile_path])
    captured = capsys.readouterr()
    assert captured.out.strip() == f"""
{testfile_path} is empty.
""".strip()
Exemple #2
0
def test_MloxRuleManager_report_withoutSections_withSectionsFlag(capsys):
    testfile_path = os.path.join(testfile_dir, "loose_rules.txt")
    cli.main(args=["report", "--sections", testfile_path])
    assert capsys.readouterr().out.strip() == f"""
{testfile_path} report:
	Header: Yes
	0 Mod Sections
""".strip()
Exemple #3
0
def test_MloxRuleManager_report_multipleUniqueSections_sorted(capsys):
    testfile_path = os.path.join(testfile_dir, "unique_sorted_sections.txt")
    cli.main(args=["report", testfile_path])
    assert capsys.readouterr().out.strip() == f"""
{testfile_path} report:
	Header: No
	2 Mod Sections
	Sections Sorted: Yes
	0 Duplicate Section Names
""".strip()
Exemple #4
0
def test_MloxRuleManager_report_singleSection_noHeader(capsys):
    testfile_path = os.path.join(testfile_dir, "single_section.txt")
    cli.main(args=["report", testfile_path])
    assert capsys.readouterr().out.strip() == f"""
{testfile_path} report:
	Header: No
	1 Mod Section
	Sections Sorted: Yes
	0 Duplicate Section Names
""".strip()
Exemple #5
0
def test_MloxRuleManager_report_duplicateSectionNames(capsys):
    testfile_path = os.path.join(testfile_dir, "duplicate_sections.txt")
    cli.main(args=["report", testfile_path])
    assert capsys.readouterr().out.strip() == f"""
{testfile_path} report:
	Header: No
	2 Mod Sections
	Sections Sorted: Yes
	1 Duplicate Section Name:
		mod2 [author2]: line 1, line 9
""".strip()
Exemple #6
0
def test_MloxRuleManager_report_header_singleSection_withSectionsFlag(capsys):
    testfile_path = os.path.join(testfile_dir,
                                 "single_section_with_header.txt")
    cli.main(args=["report", "--sections", testfile_path])
    assert capsys.readouterr().out.strip() == f"""
{testfile_path} report:
	Header: Yes
	1 Mod Section
	Sections Sorted: Yes
	0 Duplicate Section Names

	Sections found:
		mod1 [author1]
""".strip()
Exemple #7
0
def test_MloxRuleManager_report_multipleUniqueSections_sorted_withSectionsFlag(
        capsys):
    testfile_path = os.path.join(testfile_dir, "unique_sorted_sections.txt")
    cli.main(args=["report", "--sections", testfile_path])
    assert capsys.readouterr().out.strip() == f"""
{testfile_path} report:
	Header: No
	2 Mod Sections
	Sections Sorted: Yes
	0 Duplicate Section Names

	Sections found:
		abc_mod [author2]
		mod1 [author1]
""".strip()
Exemple #8
0
def test_MloxRuleManager_report_combined(capsys):
    testfile_path = os.path.join(testfile_dir, "report_tester.txt")
    cli.main(args=["report", "--sections", testfile_path])
    assert capsys.readouterr().out.strip() == f"""
{testfile_path} report:
	Header: Yes
	6 Mod Sections
	Sections Sorted: No
	2 Duplicate Section Names:
		mod2 [author2]: line 9, line 49
		abc_mod [author1]: line 17, line 28

	Sections found:
		mod2 [author2]
		abc_mod [author1]
		abc_mod [author1]
		unique_mod [author3]
		mod2 [author2]
		mod2 [otherauthor]
""".strip()
Exemple #9
0
def test_MloxRuleManager_report_emptyFile(capsys):
    testfile_path = os.path.join(testfile_dir, "empty.txt")
    cli.main(args=["report", testfile_path])
    assert capsys.readouterr().out.strip() == f"""
{testfile_path} is empty.
""".strip()