Skip to content

unit tests under bit_manipulation #12693

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 29, 2025
commit e7b388452bc5173443c94f124e10f4778e1ebd08
1 change: 1 addition & 0 deletions bit_manipulation/scale_list.py
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
This function multiplies every element of the input list by a given factor.
"""


def scale_list(numbers: list, factor: float) -> list:
"""
Scale each number in the list by a given factor.
2 changes: 2 additions & 0 deletions bit_manipulation/test_scale_list.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import unittest
from bit_manipulation.scale_list import scale_list

Check failure on line 2 in bit_manipulation/test_scale_list.py

GitHub Actions / ruff

Ruff (I001)

bit_manipulation/test_scale_list.py:1:1: I001 Import block is un-sorted or un-formatted


class TestScaleList(unittest.TestCase):
def test_scaling(self):
self.assertEqual(scale_list([1, 2, 3], 2), [2, 4, 6])

Check failure on line 7 in bit_manipulation/test_scale_list.py

GitHub Actions / ruff

Ruff (PT009)

bit_manipulation/test_scale_list.py:7:9: PT009 Use a regular `assert` instead of unittest-style `assertEqual`
self.assertEqual(scale_list([-1, -2], 3), [-3, -6])

Check failure on line 8 in bit_manipulation/test_scale_list.py

GitHub Actions / ruff

Ruff (PT009)

bit_manipulation/test_scale_list.py:8:9: PT009 Use a regular `assert` instead of unittest-style `assertEqual`
self.assertEqual(scale_list([0, 1], 0), [0, 0])

Check failure on line 9 in bit_manipulation/test_scale_list.py

GitHub Actions / ruff

Ruff (PT009)

bit_manipulation/test_scale_list.py:9:9: PT009 Use a regular `assert` instead of unittest-style `assertEqual`


if __name__ == "__main__":
unittest.main()
Loading
Oops, something went wrong.