| @@ 313-330 (lines=18) @@ | ||
| 310 | assert [p.relpath(root) for p in root] == [] |
|
| 311 | ||
| 312 | ||
| 313 | def test_rm(): |
|
| 314 | files = """ |
|
| 315 | - a |
|
| 316 | - b |
|
| 317 | """ |
|
| 318 | with create_files(files) as _root: |
|
| 319 | root = path.Path(_root) |
|
| 320 | assert {p.relpath(root) for p in root} == {'a', 'b'} |
|
| 321 | ||
| 322 | b = root / 'b' |
|
| 323 | b.rm() |
|
| 324 | assert [p.relpath(root) for p in root] == ['a'] |
|
| 325 | ||
| 326 | root.rm('a') |
|
| 327 | assert [p.relpath(root) for p in root] == [] |
|
| 328 | ||
| 329 | root.rm('c') # shouldn't raise |
|
| 330 | assert [p.relpath(root) for p in root] == [] |
|
| 331 | ||
| 332 | ||
| 333 | def test_glob(): |
|
| @@ 295-310 (lines=16) @@ | ||
| 292 | assert root.listdir() == [] |
|
| 293 | ||
| 294 | ||
| 295 | def test_unlink(): |
|
| 296 | files = """ |
|
| 297 | - a |
|
| 298 | - b |
|
| 299 | """ |
|
| 300 | with create_files(files) as _root: |
|
| 301 | root = path.Path(_root) |
|
| 302 | assert {p.relpath(root) for p in root} == {'a', 'b'} |
|
| 303 | ||
| 304 | b = root / 'b' |
|
| 305 | b.unlink() |
|
| 306 | assert [p.relpath(root) for p in root] == ['a'] |
|
| 307 | ||
| 308 | a = root / 'a' |
|
| 309 | a.remove() |
|
| 310 | assert [p.relpath(root) for p in root] == [] |
|
| 311 | ||
| 312 | ||
| 313 | def test_rm(): |
|