Skip to content

Commit 230fad9

Browse files
committed
More reformatting
1 parent c4ad77d commit 230fad9

File tree

2 files changed

+53
-42
lines changed

2 files changed

+53
-42
lines changed

test/test_options.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def test_user_agent_product() -> None:
287287
def test_add_ssl_x509_cert() -> None:
288288
# Test adding an SSL certificate
289289
# This is a minimal test certificate (not valid, but tests the API)
290-
test_cert = "-----BEGIN CERTIFICATE-----\nMIIB...\n-----END CERTIFICATE-----"
290+
test_cert = '-----BEGIN CERTIFICATE-----\nMIIB...\n-----END CERTIFICATE-----'
291291

292292
try:
293293
option(Option.ADD_SSL_X509_CERT, test_cert)
@@ -297,8 +297,8 @@ def test_add_ssl_x509_cert() -> None:
297297
msg = str(e).lower()
298298
if (
299299
"tls backend doesn't support" not in msg
300-
and "invalid" not in msg
301-
and "failed to add raw x509 certificate" not in msg
300+
and 'invalid' not in msg
301+
and 'failed to add raw x509 certificate' not in msg
302302
):
303303
raise
304304

test/test_settings.py

Lines changed: 50 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def test_enable_caching() -> None:
6767
# Verify the method exists and accepts boolean values without raising
6868
assert hasattr(pygit2.settings, 'enable_caching')
6969
assert callable(pygit2.settings.enable_caching)
70-
70+
7171
# Should not raise exceptions
7272
pygit2.settings.enable_caching(False)
7373
pygit2.settings.enable_caching(True)
@@ -77,7 +77,7 @@ def test_disable_pack_keep_file_checks() -> None:
7777
"""Test disable pack keep file checks"""
7878
assert hasattr(pygit2.settings, 'disable_pack_keep_file_checks')
7979
assert callable(pygit2.settings.disable_pack_keep_file_checks)
80-
80+
8181
# Should not raise exceptions
8282
pygit2.settings.disable_pack_keep_file_checks(False)
8383
pygit2.settings.disable_pack_keep_file_checks(True)
@@ -96,26 +96,34 @@ def test_cache_max_size() -> None:
9696
pygit2.settings.cache_max_size(original_max_size)
9797

9898

99-
@pytest.mark.parametrize("object_type,test_size,default_size", [
100-
(ObjectType.BLOB, 2 * 1024, 0),
101-
(ObjectType.COMMIT, 8 * 1024, 4096),
102-
(ObjectType.TREE, 8 * 1024, 4096),
103-
(ObjectType.TAG, 8 * 1024, 4096),
104-
(ObjectType.BLOB, 0, 0),
105-
])
106-
def test_cache_object_limit(object_type: ObjectType, test_size: int, default_size: int) -> None:
99+
@pytest.mark.parametrize(
100+
'object_type,test_size,default_size',
101+
[
102+
(ObjectType.BLOB, 2 * 1024, 0),
103+
(ObjectType.COMMIT, 8 * 1024, 4096),
104+
(ObjectType.TREE, 8 * 1024, 4096),
105+
(ObjectType.TAG, 8 * 1024, 4096),
106+
(ObjectType.BLOB, 0, 0),
107+
],
108+
)
109+
def test_cache_object_limit(
110+
object_type: ObjectType, test_size: int, default_size: int
111+
) -> None:
107112
"""Test set cache object limit"""
108113
assert callable(pygit2.settings.cache_object_limit)
109-
114+
110115
pygit2.settings.cache_object_limit(object_type, test_size)
111116
pygit2.settings.cache_object_limit(object_type, default_size)
112117

113118

114-
@pytest.mark.parametrize("level,test_path", [
115-
(ConfigLevel.GLOBAL, '/tmp/test_global'),
116-
(ConfigLevel.XDG, '/tmp/test_xdg'),
117-
(ConfigLevel.SYSTEM, '/tmp/test_system'),
118-
])
119+
@pytest.mark.parametrize(
120+
'level,test_path',
121+
[
122+
(ConfigLevel.GLOBAL, '/tmp/test_global'),
123+
(ConfigLevel.XDG, '/tmp/test_xdg'),
124+
(ConfigLevel.SYSTEM, '/tmp/test_system'),
125+
],
126+
)
119127
def test_search_path(level: ConfigLevel, test_path: str) -> None:
120128
"""Test get/set search paths"""
121129
original = pygit2.settings.search_path[level]
@@ -209,7 +217,7 @@ def test_server_timeouts() -> None:
209217
try:
210218
pygit2.settings.server_connect_timeout = 5000
211219
assert pygit2.settings.server_connect_timeout == 5000
212-
220+
213221
pygit2.settings.server_timeout = 10000
214222
assert pygit2.settings.server_timeout == 10000
215223
finally:
@@ -223,7 +231,7 @@ def test_extensions() -> None:
223231
try:
224232
test_extensions = ['objectformat', 'worktreeconfig']
225233
pygit2.settings.set_extensions(test_extensions)
226-
234+
227235
new_extensions = pygit2.settings.extensions
228236
for ext in test_extensions:
229237
assert ext in new_extensions
@@ -232,37 +240,40 @@ def test_extensions() -> None:
232240
pygit2.settings.set_extensions(original)
233241

234242

235-
@pytest.mark.parametrize("method_name,default_value", [
236-
('enable_strict_object_creation', True),
237-
('enable_strict_symbolic_ref_creation', True),
238-
('enable_ofs_delta', True),
239-
('enable_fsync_gitdir', False),
240-
('enable_strict_hash_verification', True),
241-
('enable_unsaved_index_safety', False),
242-
('enable_http_expect_continue', False),
243-
])
243+
@pytest.mark.parametrize(
244+
'method_name,default_value',
245+
[
246+
('enable_strict_object_creation', True),
247+
('enable_strict_symbolic_ref_creation', True),
248+
('enable_ofs_delta', True),
249+
('enable_fsync_gitdir', False),
250+
('enable_strict_hash_verification', True),
251+
('enable_unsaved_index_safety', False),
252+
('enable_http_expect_continue', False),
253+
],
254+
)
244255
def test_enable_methods(method_name: str, default_value: bool) -> None:
245256
"""Test various enable methods"""
246257
assert hasattr(pygit2.settings, method_name)
247258
method = getattr(pygit2.settings, method_name)
248259
assert callable(method)
249-
260+
250261
method(True)
251262
method(False)
252263
method(default_value)
253264

254265

255-
@pytest.mark.parametrize("priority", [1, 5, 10, 0, -1, -2])
266+
@pytest.mark.parametrize('priority', [1, 5, 10, 0, -1, -2])
256267
def test_odb_priorities(priority: int) -> None:
257268
"""Test setting ODB priorities"""
258269
assert hasattr(pygit2.settings, 'set_odb_packed_priority')
259270
assert hasattr(pygit2.settings, 'set_odb_loose_priority')
260271
assert callable(pygit2.settings.set_odb_packed_priority)
261272
assert callable(pygit2.settings.set_odb_loose_priority)
262-
273+
263274
pygit2.settings.set_odb_packed_priority(priority)
264275
pygit2.settings.set_odb_loose_priority(priority)
265-
276+
266277
pygit2.settings.set_odb_packed_priority(1)
267278
pygit2.settings.set_odb_loose_priority(2)
268279

@@ -271,7 +282,7 @@ def test_ssl_methods() -> None:
271282
"""Test SSL-related methods"""
272283
assert callable(pygit2.settings.set_ssl_ciphers)
273284
assert callable(pygit2.settings.add_ssl_x509_cert)
274-
285+
275286
ssl_ciphers_supported = True
276287
try:
277288
pygit2.settings.set_ssl_ciphers('DEFAULT')
@@ -280,26 +291,26 @@ def test_ssl_methods() -> None:
280291
if "tls backend doesn't support" not in msg:
281292
raise
282293
ssl_ciphers_supported = False
283-
284-
test_cert = "-----BEGIN CERTIFICATE-----\nMIIB...\n-----END CERTIFICATE-----"
294+
295+
test_cert = '-----BEGIN CERTIFICATE-----\nMIIB...\n-----END CERTIFICATE-----'
285296
x509_cert_supported = True
286297
try:
287298
pygit2.settings.add_ssl_x509_cert(test_cert)
288299
except pygit2.GitError as e:
289300
msg = str(e).lower()
290301
if (
291302
"tls backend doesn't support" not in msg
292-
and "invalid" not in msg
293-
and "failed to add raw x509 certificate" not in msg
303+
and 'invalid' not in msg
304+
and 'failed to add raw x509 certificate' not in msg
294305
):
295306
raise
296307
x509_cert_supported = False
297-
308+
298309
# At least verify the methods exist even if not supported
299310
assert not ssl_ciphers_supported or not x509_cert_supported or True
300311

301312

302-
@pytest.mark.skipif(sys.platform != "win32", reason="Windows-specific feature")
313+
@pytest.mark.skipif(sys.platform != 'win32', reason='Windows-specific feature')
303314
def test_windows_sharemode() -> None:
304315
"""Test get/set Windows share mode"""
305316
original = pygit2.settings.windows_sharemode
@@ -309,4 +320,4 @@ def test_windows_sharemode() -> None:
309320
pygit2.settings.windows_sharemode = 2
310321
assert pygit2.settings.windows_sharemode == 2
311322
finally:
312-
pygit2.settings.windows_sharemode = original
323+
pygit2.settings.windows_sharemode = original

0 commit comments

Comments
 (0)