@@ -114,42 +114,42 @@ async def test_move(
114114
115115@pytest .mark .parametrize ("exclusive" , [True , False ])
116116def test_atomic_write_successful (tmp_path : pathlib .Path , exclusive : bool ) -> None :
117- path = pathlib .Path (tmp_path ) / ' data'
118- with _atomic_write (path , 'wb' , exclusive = exclusive ) as f :
119- f .write (b' abc' )
120- assert path .read_bytes () == b' abc'
117+ path = pathlib .Path (tmp_path ) / " data"
118+ with _atomic_write (path , "wb" , exclusive = exclusive ) as f :
119+ f .write (b" abc" )
120+ assert path .read_bytes () == b" abc"
121121 assert list (path .parent .iterdir ()) == [path ] # no temp files
122122
123123
124124@pytest .mark .parametrize ("exclusive" , [True , False ])
125125def test_atomic_write_incomplete (tmp_path : pathlib .Path , exclusive : bool ) -> None :
126- path = pathlib .Path (tmp_path ) / ' data'
126+ path = pathlib .Path (tmp_path ) / " data"
127127 with pytest .raises (RuntimeError ): # noqa: PT012
128- with _atomic_write (path , 'wb' , exclusive = exclusive ) as f :
129- f .write (b'a' )
128+ with _atomic_write (path , "wb" , exclusive = exclusive ) as f :
129+ f .write (b"a" )
130130 raise RuntimeError
131131 assert not path .exists ()
132132 assert list (path .parent .iterdir ()) == [] # no temp files
133133
134134
135135def test_atomic_write_non_exclusive_preexisting (tmp_path : pathlib .Path ) -> None :
136- path = pathlib .Path (tmp_path ) / ' data'
137- with path .open ('wb' ) as f :
138- f .write (b' xyz' )
139- assert path .read_bytes () == b' xyz'
140- with _atomic_write (path , 'wb' , exclusive = False ) as f :
141- f .write (b' abc' )
142- assert path .read_bytes () == b' abc'
136+ path = pathlib .Path (tmp_path ) / " data"
137+ with path .open ("wb" ) as f :
138+ f .write (b" xyz" )
139+ assert path .read_bytes () == b" xyz"
140+ with _atomic_write (path , "wb" , exclusive = False ) as f :
141+ f .write (b" abc" )
142+ assert path .read_bytes () == b" abc"
143143 assert list (path .parent .iterdir ()) == [path ] # no temp files
144144
145145
146146def test_atomic_write_exclusive_preexisting (tmp_path : pathlib .Path ) -> None :
147- path = pathlib .Path (tmp_path ) / ' data'
148- with path .open ('wb' ) as f :
149- f .write (b' xyz' )
150- assert path .read_bytes () == b' xyz'
147+ path = pathlib .Path (tmp_path ) / " data"
148+ with path .open ("wb" ) as f :
149+ f .write (b" xyz" )
150+ assert path .read_bytes () == b" xyz"
151151 with pytest .raises (FileExistsError ):
152- with _atomic_write (path , 'wb' , exclusive = True ) as f :
153- f .write (b' abc' )
154- assert path .read_bytes () == b' xyz'
152+ with _atomic_write (path , "wb" , exclusive = True ) as f :
153+ f .write (b" abc" )
154+ assert path .read_bytes () == b" xyz"
155155 assert list (path .parent .iterdir ()) == [path ] # no temp files
0 commit comments