ruff/crates/ruff_linter/resources/test/fixtures/refurb/FURB177.py
Daniel Parizher 78b8741352
[refurb] Implement implicit-cwd (FURB177) (#7704)
## Summary

Implement
[`no-implicit-cwd`](https://github.com/dosisod/refurb/blob/master/docs/checks.md#furb177-no-implicit-cwd)
as `implicit-cwd`

Related to #1348.

## Test Plan

`cargo test`
2023-09-29 02:18:59 +00:00

31 lines
601 B
Python

import pathlib
from pathlib import Path
# Errors
_ = Path().resolve()
_ = pathlib.Path().resolve()
_ = Path("").resolve()
_ = pathlib.Path("").resolve()
_ = Path(".").resolve()
_ = pathlib.Path(".").resolve()
_ = Path("", **kwargs).resolve()
_ = pathlib.Path("", **kwargs).resolve()
_ = Path(".", **kwargs).resolve()
_ = pathlib.Path(".", **kwargs).resolve()
# OK
_ = Path.cwd()
_ = pathlib.Path.cwd()
_ = Path("foo").resolve()
_ = pathlib.Path("foo").resolve()
_ = Path(".", "foo").resolve()
_ = pathlib.Path(".", "foo").resolve()
_ = Path(*args).resolve()
_ = pathlib.Path(*args).resolve()