Skip to content

[List Ops]: def concat(lists) possible test error #3142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dfreeman500 opened this issue Jul 14, 2022 · 4 comments
Closed

[List Ops]: def concat(lists) possible test error #3142

dfreeman500 opened this issue Jul 14, 2022 · 4 comments

Comments

@dfreeman500
Copy link

Hello,
I'm a relative newbie so hopefully I'm not adding more work.

In the Python List Ops project 'list_ops.py',

def concat(lists): is supposed to "(given a series of lists, combine all items in all lists into one flattened list)".

On line 36 in the test file the expected result does not appear to be a flattened list:
def test_concat_list_of_nested_lists(self): self.assertEqual( concat([[[1], [2]], [[3]], [[]], [[4, 5, 6]]]), [[1], [2], [3], [], [4, 5, 6]], )

I would expect that the test should actually be:

def test_concat_list_of_nested_lists(self): self.assertEqual( concat([[[1], [2]], [[3]], [[]], [[4, 5, 6]]]), [1, 2, 3, 4, 5, 6], )

So, [1, 2, 3, 4, 5, 6] instead of [[1], [2], [3], [], [4, 5, 6]]

Thanks for all you do!

@github-actions
Copy link
Contributor

🤖   🤖

Hi! 👋🏽 👋 Welcome to the Exercism Python Repo!

Thank you for opening an issue! 🐍  🌈 ✨


  •   If you are requesting support, we will be along shortly to help. (generally within 72 hours, often more quickly).
  •   Found a problem with tests, exercises or something else??  🎉
      ◦ We'll take a look as soon as we can & identify what work is needed to fix it. (generally within 72 hours).

​          ◦ If you'd also like to make a PR to fix the issue, please have a quick look at the Pull Requests doc.
             We  💙  PRs that follow our Exercism & Track contributing guidelines!

  •   Here because of an obvious (and small set of) spelling, grammar, or punctuation issues with one exercise,
      concept, or Python document?? 🌟 Please feel free to submit a PR, linking to this issue. 🎉
    ‼️  Please Do Not ‼️

    ​        ❗ Run checks on the whole repo & submit a bunch of PRs.
                  This creates longer review cycles & exhausts reviewers energy & time.
                  It may also conflict with ongoing changes from other contributors.
    ​        ❗ Insert only blank lines, make a closing bracket drop to the next line, change a word
                  to a synonym without obvious reason, or add trailing space that's not an EOL for the very end of text files.
            ❗ Introduce arbitrary changes "just to change things" .

            ...These sorts of things are not considered helpful, and will likely be closed by reviewers.

  • For anything complicated or ambiguous, let's discuss things -- we will likely welcome a PR from you.
  • Here to suggest a feature or new exercise?? Hooray! Please keep in mind Chesterton's Fence.
    Thoughtful suggestions will likely result faster & more enthusiastic responses from maintainers.

💛  💙  While you are here... If you decide to help out with other open issues, you have our gratitude 🙌 🙌🏽.
Anything tagged with [help wanted] and without [Claimed] is up for grabs.
Comment on the issue and we will reserve it for you. 🌈 ✨

@dfreeman500 dfreeman500 changed the title List Ops def concat(lists) [List Ops] def concat(lists) Jul 14, 2022
@dfreeman500 dfreeman500 changed the title [List Ops] def concat(lists) [List Ops]: def concat(lists) possible test error Jul 14, 2022
@IsaacG
Copy link
Member

IsaacG commented Jul 14, 2022

The prose might benefit from some rewording but this is an intro to lists exercise. There's an explicit and specific exercise for list flattening which is distinct from this exercise.

@BethanyG
Copy link
Member

Hi @dfreeman500 👋🏽

Thanks for filing this issue.

We pull the test cases for practice exercises from a common repo, problem specifications and use a test-case generator here on the Python track to turn the canonical data for a given exercise into python unittest/pytest test cases.

Here is the canonical data for List-Ops. As you can see, the expected result treats the innermost lists as elements, and does not unpack them, but does remove the enclosing (second-level) lists. So it does appear the spirit here is "flatten to one" as opposed to "recursively unpack".

With all that being said, I agree that the word "flattened" could be easily mis-interpreted in the instructions, and could benefit from some more detail or explanation.

I'd suggest that you PR a change/start a discussion about the exercise in problem specifications, and perhaps ask about the logic of the expected result for that case. I know in Python that a general default is one level of unpacking, but this is actually two levels, but not a full unpack. We may want to examine how/why that test case is there, and if it needs to be altered and/or the instructions altered.

@BethanyG
Copy link
Member

Closing this for now, since the issue lies in problem specifications. Can re-open if an instruction append on the track is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants