Ejemplo n.º 1
0
def test_eq_different_types():
	pc1 = PathChecker("ajxoj/io.txt", ".pdf")
	pc2 = 5
	assert pc1 != pc2
Ejemplo n.º 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
Ejemplo n.º 4
0
def test_eq_different_extensions():
	pc1 = PathChecker("ajxoj/io.txt", ".pdf")
	pc2 = PathChecker("ajxoj/io.txt", ".docx")
	assert pc1 != pc2
Ejemplo n.º 5
0
def test_exten_is_correct_false_no_expected_exten():
	pc = PathChecker("ajxoj/io.txt", "")
	assert not pc.extension_is_correct()
Ejemplo n.º 6
0
def test_path_exists_true():
	pc = PathChecker("some_dir/un_fichier_pdf.pdf", ".pdf")
	assert pc.path_exists()
Ejemplo n.º 7
0
def test_path_is_file_false():
	pc = PathChecker("some_dir", ".pdf")
	assert not pc.path_is_file()
Ejemplo n.º 8
0
def test_exten_is_correct_true_no_exten():
	pc = PathChecker("ajxoj/io", "")
	assert pc.extension_is_correct()
Ejemplo n.º 9
0
def test_path_is_dir_inexistent():
	pc = PathChecker("ajxoj", ".pdf")
	assert not pc.path_is_dir()
Ejemplo n.º 10
0
def test_path_is_file_true():
	pc = PathChecker("some_dir/un_fichier_pdf.pdf", ".pdf")
	assert pc.path_is_file()
Ejemplo n.º 11
0
def test_init_with_exten():
	pc = PathChecker("ajxoj/io.txt", ".pdf")
	assert pc.path == Path("ajxoj/io.txt")
	assert pc.extension == ".pdf"
Ejemplo n.º 12
0
def test_path_is_dir_false():
	pc = PathChecker("some_dir/un_fichier_pdf.pdf", ".pdf")
	assert not pc.path_is_dir()
Ejemplo n.º 13
0
def test_path_is_dir_true():
	pc = PathChecker("some_dir", ".pdf")
	assert pc.path_is_dir()
Ejemplo n.º 14
0
def test_init_no_exten():
	pc = PathChecker("ajxoj/io.txt", "")
	assert pc.path == Path("ajxoj/io.txt")
	assert pc.extension == ""
Ejemplo n.º 15
0
def test_path_is_file_inexistent():
	pc = PathChecker("ajxoj/io.txt", ".pdf")
	assert not pc.path_is_file()
Ejemplo n.º 16
0
def test_exten_is_correct_true():
	pc = PathChecker("ajxoj/io.txt", ".txt")
	assert pc.extension_is_correct()
Ejemplo n.º 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")
Ejemplo n.º 18
0
def test_exten_is_correct_false_no_exten():
	pc = PathChecker("ajxoj/io", ".pdf")
	assert not pc.extension_is_correct()
Ejemplo n.º 19
0
def test_eq_same():
	pc1 = PathChecker("ajxoj/io.txt", ".pdf")
	pc2 = PathChecker("ajxoj/io.txt", ".pdf")
	assert pc1 == pc2
Ejemplo n.º 20
0
def test_get_file_stem():
	pc = PathChecker("ajxoj/io.txt", ".pdf")
	assert pc.get_file_stem() == "io"
Ejemplo n.º 21
0
def test_eq_different_paths():
	pc1 = PathChecker("ajxoj/io.txt", ".pdf")
	pc2 = PathChecker("ajxoj/tio.txt", ".pdf")
	assert pc1 != pc2
Ejemplo n.º 22
0
def test_path_exists_false():
	pc = PathChecker("ajxoj/io.txt", ".pdf")
	assert not pc.path_exists()
Ejemplo n.º 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")