Skip to content

Commit f47d75f

Browse files
thughescopybara-github
authored andcommitted
Fix pylint warning
Possible unbalanced tuple unpacking with sequence defined at line N: left side has 1 label(s), right side has 0 value(s) [unbalanced-tuple-unpacking] PiperOrigin-RevId: 504640001 Change-Id: If8d6038a9acf74a409cb6b6ee30cea7745b4b303
1 parent 137dcd1 commit f47d75f

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

googletest/test/googletest-shuffle-test.py

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -275,33 +275,38 @@ def testShuffleRestoresOrderAfterEachIteration(self):
275275
# iteration, and this test depends on the current implementation
276276
# picking successive numbers. This dependency is not ideal, but
277277
# makes the test much easier to write.
278+
# pylint: disable-next=unbalanced-tuple-unpacking
278279
[tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (
279280
GetTestsForAllIterations(
280281
{}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))
281282

282283
# Make sure running the tests with random seed 1 gets the same
283284
# order as in iteration 1 above.
284-
[tests_with_seed1] = GetTestsForAllIterations(
285-
{}, [ShuffleFlag(), RandomSeedFlag(1)])
285+
tests_with_seed1 = GetTestsForAllIterations(
286+
{}, [ShuffleFlag(), RandomSeedFlag(1)]
287+
)[0]
286288
self.assertEqual(tests_in_iteration1, tests_with_seed1)
287289

288290
# Make sure running the tests with random seed 2 gets the same
289291
# order as in iteration 2 above. Success means that Google Test
290292
# correctly restores the test order before re-shuffling at the
291293
# beginning of iteration 2.
292-
[tests_with_seed2] = GetTestsForAllIterations(
293-
{}, [ShuffleFlag(), RandomSeedFlag(2)])
294+
tests_with_seed2 = GetTestsForAllIterations(
295+
{}, [ShuffleFlag(), RandomSeedFlag(2)]
296+
)[0]
294297
self.assertEqual(tests_in_iteration2, tests_with_seed2)
295298

296299
# Make sure running the tests with random seed 3 gets the same
297300
# order as in iteration 3 above. Success means that Google Test
298301
# correctly restores the test order before re-shuffling at the
299302
# beginning of iteration 3.
300-
[tests_with_seed3] = GetTestsForAllIterations(
301-
{}, [ShuffleFlag(), RandomSeedFlag(3)])
303+
tests_with_seed3 = GetTestsForAllIterations(
304+
{}, [ShuffleFlag(), RandomSeedFlag(3)]
305+
)[0]
302306
self.assertEqual(tests_in_iteration3, tests_with_seed3)
303307

304308
def testShuffleGeneratesNewOrderInEachIteration(self):
309+
# pylint: disable-next=unbalanced-tuple-unpacking
305310
[tests_in_iteration1, tests_in_iteration2, tests_in_iteration3] = (
306311
GetTestsForAllIterations(
307312
{}, [ShuffleFlag(), RandomSeedFlag(1), RepeatFlag(3)]))
@@ -319,15 +324,18 @@ def testShuffleGeneratesNewOrderInEachIteration(self):
319324
def testShuffleShardedTestsPreservesPartition(self):
320325
# If we run M tests on N shards, the same M tests should be run in
321326
# total, regardless of the random seeds used by the shards.
322-
[tests1] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
323-
SHARD_INDEX_ENV_VAR: '0'},
324-
[ShuffleFlag(), RandomSeedFlag(1)])
325-
[tests2] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
326-
SHARD_INDEX_ENV_VAR: '1'},
327-
[ShuffleFlag(), RandomSeedFlag(20)])
328-
[tests3] = GetTestsForAllIterations({TOTAL_SHARDS_ENV_VAR: '3',
329-
SHARD_INDEX_ENV_VAR: '2'},
330-
[ShuffleFlag(), RandomSeedFlag(25)])
327+
tests1 = GetTestsForAllIterations(
328+
{TOTAL_SHARDS_ENV_VAR: '3', SHARD_INDEX_ENV_VAR: '0'},
329+
[ShuffleFlag(), RandomSeedFlag(1)],
330+
)[0]
331+
tests2 = GetTestsForAllIterations(
332+
{TOTAL_SHARDS_ENV_VAR: '3', SHARD_INDEX_ENV_VAR: '1'},
333+
[ShuffleFlag(), RandomSeedFlag(20)],
334+
)[0]
335+
tests3 = GetTestsForAllIterations(
336+
{TOTAL_SHARDS_ENV_VAR: '3', SHARD_INDEX_ENV_VAR: '2'},
337+
[ShuffleFlag(), RandomSeedFlag(25)],
338+
)[0]
331339
sorted_sharded_tests = tests1 + tests2 + tests3
332340
sorted_sharded_tests.sort()
333341
sorted_active_tests = []

0 commit comments

Comments
 (0)