Skip to content
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

Brainteasers: array_product #22

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Brainteasers: array_product #22

wants to merge 2 commits into from

Conversation

Wagoory
Copy link
Collaborator

@Wagoory Wagoory commented Jan 21, 2024

  • PR's title includes the challenge's name and language
  • PR has short and clear description of the challenge
  • PR has appropriate labels and milestones for easy identification
  • PR it is assigned to the owner
  • reviewers are assigned
  • the PR contributes only one focused change
  • the branch is up to date with main/master
  • the code works when pulled and run locally
  • all conflicts are resolved (if any)
  • It is linked to an issue in the appropriate column of the project board
  • feedback is addressed (if any, and if it is appropriate feedback.)

README Documentation

  • The solution is documented in /src/README.md
  • The markdown source is formatted
  • Spelling and grammar is correct in all text
  • The markdown looks correct when you preview the file
  • All links and images work
  • The README documents the solution's behavior, strategy(ies) and implementation(s)
  • There are use cases in code blocks to illustrate the function's behavior

Python Files

  • There is a module header
  • There is a module docstring
  • File names are in snake_case
  • Test files are named test_<module_name>.py

Function Docstring

  • Behavior description
  • Parameter description
  • Return value description
  • Include any assumptions
  • Include 3 or more (passing!) doctests
  • Include 1-2 use cases (if necessary)

Function Implementation

  • The solution is not is not copied from djeada
  • The code is auto-formatted
  • The code has no (reasonable) linting mistakes
  • Variables are named with snake_case
  • The function has a clear and helpful name
  • The file's name matches the function name
  • The code follows the strategy as simply as possible
  • Variable names are clear and helpful
  • Comments explain the strategy (if necessary)
  • There are type annotations
  • (challenge) The code includes defensive assertions

Unit Test Suite

  • The test class has a helpful name in PascalCase
  • The test class has a docstring
  • Each unit test has
    • A helpful name
    • A clear docstring
    • Only one assertion
  • All tests pass
  • There are tests for defensive assertions
  • There are tests for boundary cases
  • Test suite includes black-box and glass-box tests

@Wagoory Wagoory added this to the brain_teasers milestone Jan 21, 2024
@Wagoory Wagoory self-assigned this Jan 21, 2024
@dhossainali dhossainali self-requested a review January 22, 2024 11:49
@dhossainali dhossainali self-assigned this Jan 22, 2024
Copy link
Collaborator

@dhossainali dhossainali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part of coding for test is supposed to not be changed and it is kept intact and we instead need to write codes in its corresponding 'src' file and then run these tests codes. And make sure that tests are passed.

@@ -1,22 +1,38 @@
import unittest
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part of coding for test is supposed to not be changed and it is kept intact and we need to only write codes in its corresponding 'src' file the coding solutions that pass these tests.

input_array = [1, 2, 3, 4, 5]
expected = [120, 60, 40, 30, 24]
actual = product_of_array_except_self(input_array)
self.assertEqual(actual, expected)

def test_empty_array(self):
"""
This test checks if the function correctly handles the case where the input array is empty.
"""
input_array = []
expected = []
actual = product_of_array_except_self(input_array)
self.assertEqual(actual, expected)

def test_array_with_one_element(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All methods are from test part which is already developed. It does not require any changes, please keep it intact, instead you can write codes in its corresponding 'src' file and then run these tests codes. And make sure that tests are passed.

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

Successfully merging this pull request may close these issues.

2 participants