Skip to content

Commit 09826f4

Browse files
committed
Revise test_util comment style
1 parent 340da6d commit 09826f4

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

test/test_util.py

+24-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# test_utils.py
1+
# test_util.py
22
# Copyright (C) 2008, 2009 Michael Trier ([email protected]) and contributors
33
#
44
# This module is part of GitPython and is released under
@@ -275,14 +275,14 @@ def test_lock_file(self):
275275
my_file = tempfile.mktemp()
276276
lock_file = LockFile(my_file)
277277
assert not lock_file._has_lock()
278-
# release lock we don't have - fine
278+
# Release lock we don't have - fine.
279279
lock_file._release_lock()
280280

281-
# get lock
281+
# Get lock.
282282
lock_file._obtain_lock_or_raise()
283283
assert lock_file._has_lock()
284284

285-
# concurrent access
285+
# Concurrent access.
286286
other_lock_file = LockFile(my_file)
287287
assert not other_lock_file._has_lock()
288288
self.assertRaises(IOError, other_lock_file._obtain_lock_or_raise)
@@ -293,7 +293,7 @@ def test_lock_file(self):
293293
other_lock_file._obtain_lock_or_raise()
294294
self.assertRaises(IOError, lock_file._obtain_lock_or_raise)
295295

296-
# auto-release on destruction
296+
# Auto-release on destruction.
297297
del other_lock_file
298298
lock_file._obtain_lock_or_raise()
299299
lock_file._release_lock()
@@ -303,7 +303,7 @@ def test_blocking_lock_file(self):
303303
lock_file = BlockingLockFile(my_file)
304304
lock_file._obtain_lock()
305305

306-
# next one waits for the lock
306+
# Next one waits for the lock.
307307
start = time.time()
308308
wait_time = 0.1
309309
wait_lock = BlockingLockFile(my_file, 0.05, wait_time)
@@ -318,23 +318,23 @@ def test_user_id(self):
318318
self.assertIn("@", get_user_id())
319319

320320
def test_parse_date(self):
321-
# parse_date(from_timestamp()) must return the tuple unchanged
321+
# parse_date(from_timestamp()) must return the tuple unchanged.
322322
for timestamp, offset in (
323323
(1522827734, -7200),
324324
(1522827734, 0),
325325
(1522827734, +3600),
326326
):
327327
self.assertEqual(parse_date(from_timestamp(timestamp, offset)), (timestamp, offset))
328328

329-
# test all supported formats
329+
# Test all supported formats.
330330
def assert_rval(rval, veri_time, offset=0):
331331
self.assertEqual(len(rval), 2)
332332
self.assertIsInstance(rval[0], int)
333333
self.assertIsInstance(rval[1], int)
334334
self.assertEqual(rval[0], veri_time)
335335
self.assertEqual(rval[1], offset)
336336

337-
# now that we are here, test our conversion functions as well
337+
# Now that we are here, test our conversion functions as well.
338338
utctz = altz_to_utctz_str(offset)
339339
self.assertIsInstance(utctz, str)
340340
self.assertEqual(utctz_to_altz(verify_utctz(utctz)), offset)
@@ -347,13 +347,13 @@ def assert_rval(rval, veri_time, offset=0):
347347
iso3 = ("2005.04.07 22:13:11 -0000", 0)
348348
alt = ("04/07/2005 22:13:11", 0)
349349
alt2 = ("07.04.2005 22:13:11", 0)
350-
veri_time_utc = 1112911991 # the time this represents, in time since epoch, UTC
350+
veri_time_utc = 1112911991 # The time this represents, in time since epoch, UTC.
351351
for date, offset in (rfc, iso, iso2, iso3, alt, alt2):
352352
assert_rval(parse_date(date), veri_time_utc, offset)
353353
# END for each date type
354354

355-
# and failure
356-
self.assertRaises(ValueError, parse_date, datetime.now()) # non-aware datetime
355+
# ...and failure.
356+
self.assertRaises(ValueError, parse_date, datetime.now()) # Non-aware datetime.
357357
self.assertRaises(ValueError, parse_date, "invalid format")
358358
self.assertRaises(ValueError, parse_date, "123456789 -02000")
359359
self.assertRaises(ValueError, parse_date, " 123456789 -0200")
@@ -362,7 +362,7 @@ def test_actor(self):
362362
for cr in (None, self.rorepo.config_reader()):
363363
self.assertIsInstance(Actor.committer(cr), Actor)
364364
self.assertIsInstance(Actor.author(cr), Actor)
365-
# END assure config reader is handled
365+
# END ensure config reader is handled
366366

367367
@with_rw_repo("HEAD")
368368
@mock.patch("getpass.getuser")
@@ -402,7 +402,7 @@ def test_actor_get_uid_laziness_called(self, mock_get_uid):
402402
mock_get_uid.return_value = "user"
403403
committer = Actor.committer(None)
404404
author = Actor.author(None)
405-
# We can't test with `self.rorepo.config_reader()` here, as the uuid laziness
405+
# We can't test with `self.rorepo.config_reader()` here, as the UUID laziness
406406
# depends on whether the user running the test has their global user.name config set.
407407
self.assertEqual(committer.name, "user")
408408
self.assertTrue(committer.email.startswith("user@"))
@@ -436,30 +436,30 @@ def test_iterable_list(self, case):
436436

437437
self.assertEqual(len(ilist), 2)
438438

439-
# contains works with name and identity
439+
# Contains works with name and identity.
440440
self.assertIn(name1, ilist)
441441
self.assertIn(name2, ilist)
442442
self.assertIn(m2, ilist)
443443
self.assertIn(m2, ilist)
444444
self.assertNotIn("invalid", ilist)
445445

446-
# with string index
446+
# With string index.
447447
self.assertIs(ilist[name1], m1)
448448
self.assertIs(ilist[name2], m2)
449449

450-
# with int index
450+
# With int index.
451451
self.assertIs(ilist[0], m1)
452452
self.assertIs(ilist[1], m2)
453453

454-
# with getattr
454+
# With getattr.
455455
self.assertIs(ilist.one, m1)
456456
self.assertIs(ilist.two, m2)
457457

458-
# test exceptions
458+
# Test exceptions.
459459
self.assertRaises(AttributeError, getattr, ilist, "something")
460460
self.assertRaises(IndexError, ilist.__getitem__, "something")
461461

462-
# delete by name and index
462+
# Delete by name and index.
463463
self.assertRaises(IndexError, ilist.__delitem__, "something")
464464
del ilist[name2]
465465
self.assertEqual(len(ilist), 1)
@@ -494,21 +494,21 @@ def test_altz_to_utctz_str(self):
494494
self.assertEqual(altz_to_utctz_str(-59), "+0000")
495495

496496
def test_from_timestamp(self):
497-
# Correct offset: UTC+2, should return datetime + tzoffset(+2)
497+
# Correct offset: UTC+2, should return datetime + tzoffset(+2).
498498
altz = utctz_to_altz("+0200")
499499
self.assertEqual(
500500
datetime.fromtimestamp(1522827734, tzoffset(altz)),
501501
from_timestamp(1522827734, altz),
502502
)
503503

504-
# Wrong offset: UTC+58, should return datetime + tzoffset(UTC)
504+
# Wrong offset: UTC+58, should return datetime + tzoffset(UTC).
505505
altz = utctz_to_altz("+5800")
506506
self.assertEqual(
507507
datetime.fromtimestamp(1522827734, tzoffset(0)),
508508
from_timestamp(1522827734, altz),
509509
)
510510

511-
# Wrong offset: UTC-9000, should return datetime + tzoffset(UTC)
511+
# Wrong offset: UTC-9000, should return datetime + tzoffset(UTC).
512512
altz = utctz_to_altz("-9000")
513513
self.assertEqual(
514514
datetime.fromtimestamp(1522827734, tzoffset(0)),
@@ -538,7 +538,7 @@ def test_remove_password_from_command_line(self):
538538
redacted_cmd_1 = remove_password_if_present(cmd_1)
539539
assert username not in " ".join(redacted_cmd_1)
540540
assert password not in " ".join(redacted_cmd_1)
541-
# Check that we use a copy
541+
# Check that we use a copy.
542542
assert cmd_1 is not redacted_cmd_1
543543
assert username in " ".join(cmd_1)
544544
assert password in " ".join(cmd_1)

0 commit comments

Comments
 (0)