Example #1
0
def test_eq_different_types():
	pc1 = PathChecker("ajxoj/io.txt", ".pdf")
	pc2 = 5
	assert pc1 != pc2
Example #2
0
def test_repr():
	pc = PathChecker("ajxoj/io.txt", ".pdf")
	print(repr(pc))
	assert repr(pc) in (
		"PathChecker('ajxoj/io.txt', '.pdf')",
		"PathChecker('ajxoj\\io.txt', '.pdf')")
def test_pc_eq_rpc():
    pc = PathChecker("ajxoj/io.txt", ".pdf")
    rpc = ReactivePathChecker("ajxoj/io.txt", ".pdf", "awesomeArg")
    assert pc != rpc
Example #4
0
def test_eq_different_extensions():
	pc1 = PathChecker("ajxoj/io.txt", ".pdf")
	pc2 = PathChecker("ajxoj/io.txt", ".docx")
	assert pc1 != pc2
Example #5
0
def test_exten_is_correct_false_no_expected_exten():
	pc = PathChecker("ajxoj/io.txt", "")
	assert not pc.extension_is_correct()
Example #6
0
def test_path_exists_true():
	pc = PathChecker("some_dir/un_fichier_pdf.pdf", ".pdf")
	assert pc.path_exists()
Example #7
0
def test_path_is_file_false():
	pc = PathChecker("some_dir", ".pdf")
	assert not pc.path_is_file()
Example #8
0
def test_exten_is_correct_true_no_exten():
	pc = PathChecker("ajxoj/io", "")
	assert pc.extension_is_correct()
Example #9
0
def test_path_is_dir_inexistent():
	pc = PathChecker("ajxoj", ".pdf")
	assert not pc.path_is_dir()
Example #10
0
def test_path_is_file_true():
	pc = PathChecker("some_dir/un_fichier_pdf.pdf", ".pdf")
	assert pc.path_is_file()
Example #11
0
def test_init_with_exten():
	pc = PathChecker("ajxoj/io.txt", ".pdf")
	assert pc.path == Path("ajxoj/io.txt")
	assert pc.extension == ".pdf"
Example #12
0
def test_path_is_dir_false():
	pc = PathChecker("some_dir/un_fichier_pdf.pdf", ".pdf")
	assert not pc.path_is_dir()
Example #13
0
def test_path_is_dir_true():
	pc = PathChecker("some_dir", ".pdf")
	assert pc.path_is_dir()
Example #14
0
def test_init_no_exten():
	pc = PathChecker("ajxoj/io.txt", "")
	assert pc.path == Path("ajxoj/io.txt")
	assert pc.extension == ""
Example #15
0
def test_path_is_file_inexistent():
	pc = PathChecker("ajxoj/io.txt", ".pdf")
	assert not pc.path_is_file()
Example #16
0
def test_exten_is_correct_true():
	pc = PathChecker("ajxoj/io.txt", ".txt")
	assert pc.extension_is_correct()
Example #17
0
def test_init_path_exception():
	except_msg = "The given path must be an instance of pathlib.Path or str."
	with pytest.raises(TypeError, match = except_msg):
		pc = PathChecker(3.14159, ".pdf")
Example #18
0
def test_exten_is_correct_false_no_exten():
	pc = PathChecker("ajxoj/io", ".pdf")
	assert not pc.extension_is_correct()
Example #19
0
def test_eq_same():
	pc1 = PathChecker("ajxoj/io.txt", ".pdf")
	pc2 = PathChecker("ajxoj/io.txt", ".pdf")
	assert pc1 == pc2
Example #20
0
def test_get_file_stem():
	pc = PathChecker("ajxoj/io.txt", ".pdf")
	assert pc.get_file_stem() == "io"
Example #21
0
def test_eq_different_paths():
	pc1 = PathChecker("ajxoj/io.txt", ".pdf")
	pc2 = PathChecker("ajxoj/tio.txt", ".pdf")
	assert pc1 != pc2
Example #22
0
def test_path_exists_false():
	pc = PathChecker("ajxoj/io.txt", ".pdf")
	assert not pc.path_exists()
Example #23
0
def test_make_path_checker():
    warner = MissingPathArgWarner("awesomeArg", ".pdf")
    pc = warner.make_path_checker("ajxoj/io.txt")
    assert pc == PathChecker("ajxoj/io.txt", ".pdf")