88
99class PathlibTest (unittest .TestCase ):
1010 def setUp (self ) -> None :
11- self .tmpdir = tempfile .TemporaryDirectory (
12- dir = os .environ .get ("TEST_TMPDIR" )
13- )
11+ self .tmpdir = tempfile .TemporaryDirectory (dir = os .environ .get ("TEST_TMPDIR" ))
1412 # Runfiles paths are expected to be posix paths internally when we
1513 # construct the strings for assertions
1614 self .root_path = pathlib .Path (self .tmpdir .name ).resolve ()
@@ -23,9 +21,7 @@ def setUp(self) -> None:
2321 self .test_file .write_text ("hello runfiles" , encoding = "utf-8" )
2422 self .sub_dir = self .repo_dir / "subdir"
2523 self .sub_dir .mkdir ()
26- (self .sub_dir / "other.txt" ).write_text (
27- "other content" , encoding = "utf-8"
28- )
24+ (self .sub_dir / "other.txt" ).write_text ("other content" , encoding = "utf-8" )
2925
3026 def _create_runfiles (self ) -> runfiles .Runfiles :
3127 r = runfiles .Create ({"RUNFILES_DIR" : self .root_dir })
@@ -101,12 +97,8 @@ def test_parents(self) -> None:
10197 def test_with_methods (self ) -> None :
10298 r = self ._create_runfiles ()
10399 p = r .root () / "foo/bar.txt"
104- self .assertEqual (
105- str (p .with_name ("baz.py" )), f"{ self .root_dir } /foo/baz.py"
106- )
107- self .assertEqual (
108- str (p .with_suffix (".dat" )), f"{ self .root_dir } /foo/bar.dat"
109- )
100+ self .assertEqual (str (p .with_name ("baz.py" )), f"{ self .root_dir } /foo/baz.py" )
101+ self .assertEqual (str (p .with_suffix (".dat" )), f"{ self .root_dir } /foo/bar.dat" )
110102
111103 def test_match (self ) -> None :
112104 r = self ._create_runfiles ()
0 commit comments