Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tests: Clean up unused variables and unnecessary f-strings
  • Loading branch information
encukou committed Mar 27, 2023
commit 734190dec34c77ac907b90d42005f64271773f44
19 changes: 8 additions & 11 deletions Lib/test/test_tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@
from random import Random
import pathlib
import shutil
import time
import re
import datetime
import warnings
import stat
import inspect

import unittest
import unittest.mock
Expand Down Expand Up @@ -3131,23 +3128,23 @@ def test_extractall_none_mode(self):
regular_file_mode)

def test_extractall_none_uid(self):
with self.extract_with_none('uid') as DIR:
with self.extract_with_none('uid'):
pass

def test_extractall_none_gid(self):
with self.extract_with_none('gid') as DIR:
with self.extract_with_none('gid'):
pass

def test_extractall_none_uname(self):
with self.extract_with_none('uname') as DIR:
with self.extract_with_none('uname'):
pass

def test_extractall_none_gname(self):
with self.extract_with_none('gname') as DIR:
with self.extract_with_none('gname'):
pass

def test_extractall_none_ownership(self):
with self.extract_with_none('uid', 'gid', 'uname', 'gname') as DIR:
with self.extract_with_none('uid', 'gid', 'uname', 'gname'):
pass

class NoneInfoExtractTests_Data(NoneInfoExtractTests, unittest.TestCase):
Expand Down Expand Up @@ -3541,7 +3538,7 @@ def test_absolute_symlink(self):
with self.check_context(arc.open(), 'data'):
self.expect_exception(
tarfile.AbsoluteLinkError,
f"'parent' is a symlink to an absolute path")
"'parent' is a symlink to an absolute path")

def test_sly_relative0(self):
# Inspired by 'relative0' in jwilk/traversal-archives
Expand Down Expand Up @@ -3572,8 +3569,8 @@ def test_sly_relative0(self):
with self.check_context(arc.open(), filter):
self.expect_exception(
tarfile.OutsideDestinationError,
f"'../moo' would be extracted to "
+ f"'.*moo', which is outside "
"'../moo' would be extracted to "
+ "'.*moo', which is outside "
+ "the destination")

def test_sly_relative2(self):
Expand Down