Skip to content

Handle Path object #157

Description

@damienflament

Currently, files assertions are made on strings. It would be handy to accept pathlib.Path objects as it is what the pytest tmp_path fixture returns :

from assertpy import assert_that

def test_foo(tmp_path):
  f = tmp_path / "bar"
  f.touch()
  
  asset_that(f).is_a_file()

fails with :

TypeError: val is not a path

You need to make it a string :

assert_that(str(f)).is_a_file()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions