Ejemplo n.º 1
0
def test_mk(mk_fixture):
    """Testing mk command."""
    filename, pre_exist, post_exist = mk_fixture
    assert os.path.isfile(filename) == pre_exist
    mk(filename)
    assert os.path.isfile(filename) == post_exist
Ejemplo n.º 2
0
def test_contains_success():
    """Test contains_success."""
    mk(TXT_FILENAME)
    assert contains(TXT_FILENAME) == 0
    rm(TXT_FILENAME)
Ejemplo n.º 3
0
def test_mk_no_filename():
    """Test mk_no_filename."""
    assert mk() == INV_ARG
Ejemplo n.º 4
0
def test_mk(mk_fixture):
    """mk tests."""
    assert mk(mk_fixture[0]) == mk_fixture[1]
Ejemplo n.º 5
0
def test_mk_invalid_filename(tmp_path):
    """Test mk_invalid_filename."""
    filename = tmp_path / 'f/1/l/e.txt'
    assert mk(filename) == 'invalid filename'
Ejemplo n.º 6
0
def test_mk_duplicate(tmp_path):
    """Test mk_duplicate."""
    filename = tmp_path / TXT_FILENAME
    filename.write_text(TXTSTR)
    assert mk(filename) == 'file already exists'
Ejemplo n.º 7
0
def test_mk_ru_filename(tmp_path):
    """Test mk_ru_filename."""
    filename = tmp_path / 'файл.txt'
    assert mk(filename) == 'success'
Ejemplo n.º 8
0
def test_mk_en_filename(tmp_path):
    """Test mk_en_filename."""
    filename = tmp_path / TXT_FILENAME
    assert mk(filename) == 'success'
Ejemplo n.º 9
0
def test_mk(fixture_mk):
    """Test mk function."""
    filename, expected = fixture_mk
    with expected:
        mk(filename)