Skip to content

Commit 598b665

Browse files
committed
More descriptive variable names in tests
Addresses Victor's comments
1 parent cdaa540 commit 598b665

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Lib/test/datetimetester.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -833,10 +833,10 @@ class DateSubclass(date):
833833
('sub', lambda d, t: d - t, DateSubclass(2018, 1, 4)),
834834
]
835835

836-
for name, func, exp in tests:
836+
for name, func, expected in tests:
837837
with self.subTest(name):
838838
act = func(d1, td)
839-
self.assertEqual(act, exp)
839+
self.assertEqual(act, expected)
840840
self.assertIsInstance(act, DateSubclass)
841841

842842
def test_subclass_datetime(self):
@@ -852,10 +852,10 @@ class DateTimeSubclass(datetime):
852852
('sub', lambda d, t: d - t, DateTimeSubclass(2018, 1, 4, 12)),
853853
]
854854

855-
for name, func, exp in tests:
855+
for name, func, expected in tests:
856856
with self.subTest(name):
857857
act = func(d1, td)
858-
self.assertEqual(act, exp)
858+
self.assertEqual(act, expected)
859859
self.assertIsInstance(act, DateTimeSubclass)
860860

861861
def test_division(self):
@@ -2652,20 +2652,20 @@ def __new__(cls, *args, **kwargs):
26522652
('combine', (date(*args[0:3]), time(*args[3:])), base_d),
26532653
]
26542654

2655-
for constr_name, constr_args, exp in test_cases:
2655+
for constr_name, constr_args, expected in test_cases:
26562656
for base_obj in (DateTimeSubclass, base_d):
26572657
# Test both the classmethod and method
26582658
with self.subTest(base_obj_type=type(base_obj),
26592659
constr_name=constr_name):
2660-
constr = getattr(base_obj, constr_name)
2660+
constructor = getattr(base_obj, constr_name)
26612661

2662-
dt = constr(*constr_args)
2662+
dt = constructor(*constr_args)
26632663

26642664
# Test that it creates the right subclass
26652665
self.assertIsInstance(dt, DateTimeSubclass)
26662666

26672667
# Test that it's equal to the base object
2668-
self.assertEqual(dt, exp)
2668+
self.assertEqual(dt, expected)
26692669

26702670
# Test that it called the constructor
26712671
self.assertEqual(dt.extra, 7)

0 commit comments

Comments
 (0)