Updated tests and regenerated test cases for Flatten Array. (#3881)

While the example didn't need to be altered, the test cases changed enough, I think we need to re-run these.
This commit is contained in:
BethanyG
2025-03-22 11:50:30 -07:00
committed by GitHub
parent f3a33846a2
commit e348197fc0
2 changed files with 25 additions and 5 deletions

View File

@@ -32,12 +32,32 @@ description = "null values are omitted from the final result"
[c6cf26de-8ccd-4410-84bd-b9efd88fd2bc] [c6cf26de-8ccd-4410-84bd-b9efd88fd2bc]
description = "consecutive null values at the front of the list are omitted from the final result" description = "consecutive null values at the front of the list are omitted from the final result"
include = false
[bc72da10-5f55-4ada-baf3-50e4da02ec8e]
description = "consecutive null values at the front of the array are omitted from the final result"
reimplements = "c6cf26de-8ccd-4410-84bd-b9efd88fd2bc"
[382c5242-587e-4577-b8ce-a5fb51e385a1] [382c5242-587e-4577-b8ce-a5fb51e385a1]
description = "consecutive null values in the middle of the list are omitted from the final result" description = "consecutive null values in the middle of the list are omitted from the final result"
include = false
[6991836d-0d9b-4703-80a0-3f1f23eb5981]
description = "consecutive null values in the middle of the array are omitted from the final result"
reimplements = "382c5242-587e-4577-b8ce-a5fb51e385a1"
[ef1d4790-1b1e-4939-a179-51ace0829dbd] [ef1d4790-1b1e-4939-a179-51ace0829dbd]
description = "6 level nest list with null values" description = "6 level nest list with null values"
include = false
[dc90a09c-5376-449c-a7b3-c2d20d540069]
description = "6 level nested array with null values"
reimplements = "ef1d4790-1b1e-4939-a179-51ace0829dbd"
[85721643-705a-4150-93ab-7ae398e2942d] [85721643-705a-4150-93ab-7ae398e2942d]
description = "all values in nested list are null" description = "all values in nested list are null"
include = false
[51f5d9af-8f7f-4fb5-a156-69e8282cb275]
description = "all values in nested array are null"
reimplements = "85721643-705a-4150-93ab-7ae398e2942d"

View File

@@ -1,6 +1,6 @@
# These tests are auto-generated with test data from: # These tests are auto-generated with test data from:
# https://github.com/exercism/problem-specifications/tree/main/exercises/flatten-array/canonical-data.json # https://github.com/exercism/problem-specifications/tree/main/exercises/flatten-array/canonical-data.json
# File last updated on 2023-07-19 # File last updated on 2025-03-22
import unittest import unittest
@@ -45,26 +45,26 @@ class FlattenArrayTest(unittest.TestCase):
expected = [1, 2] expected = [1, 2]
self.assertEqual(flatten(inputs), expected) self.assertEqual(flatten(inputs), expected)
def test_consecutive_null_values_at_the_front_of_the_list_are_omitted_from_the_final_result( def test_consecutive_null_values_at_the_front_of_the_array_are_omitted_from_the_final_result(
self, self,
): ):
inputs = [None, None, 3] inputs = [None, None, 3]
expected = [3] expected = [3]
self.assertEqual(flatten(inputs), expected) self.assertEqual(flatten(inputs), expected)
def test_consecutive_null_values_in_the_middle_of_the_list_are_omitted_from_the_final_result( def test_consecutive_null_values_in_the_middle_of_the_array_are_omitted_from_the_final_result(
self, self,
): ):
inputs = [1, None, None, 4] inputs = [1, None, None, 4]
expected = [1, 4] expected = [1, 4]
self.assertEqual(flatten(inputs), expected) self.assertEqual(flatten(inputs), expected)
def test_6_level_nest_list_with_null_values(self): def test_6_level_nested_array_with_null_values(self):
inputs = [0, 2, [[2, 3], 8, [[100]], None, [[None]]], -2] inputs = [0, 2, [[2, 3], 8, [[100]], None, [[None]]], -2]
expected = [0, 2, 2, 3, 8, 100, -2] expected = [0, 2, 2, 3, 8, 100, -2]
self.assertEqual(flatten(inputs), expected) self.assertEqual(flatten(inputs), expected)
def test_all_values_in_nested_list_are_null(self): def test_all_values_in_nested_array_are_null(self):
inputs = [None, [[[None]]], None, None, [[None, None], None], None] inputs = [None, [[[None]]], None, None, [[None, None], None], None]
expected = [] expected = []
self.assertEqual(flatten(inputs), expected) self.assertEqual(flatten(inputs), expected)