Skip to content

Commit

Permalink
Fixing errors relating to linting and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
reunicorn1 committed Jan 12, 2025
1 parent 9320014 commit 7f81407
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
3 changes: 0 additions & 3 deletions solutions/armstrong_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,5 @@ def armstrong_checker(number: int) -> str:
armstrong_sum = sum(d**n for d in digits)

return "True" if armstrong_sum == number else "False"
<<<<<<< HEAD
# if the sum of the nth power of each digit in the number
# is equal to the number, return "True", otherwise return "False"
=======
>>>>>>> 30d157832e3def89289453b26ff2fdd600bc5e6e
18 changes: 9 additions & 9 deletions solutions/copy_from_file_to_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ def copy_file_to_file(source_file: str, destination_file: str) -> None:
"""
# Defensive checks
assert os.path.exists(
source_file
), f"Error: Source file '{source_file}' doesn't exist."
assert source_file.endswith(
".txt"
), f"Error: Source file '{source_file}' is not a .txt file."
assert destination_file.endswith(
".txt"
), f"Error: Destination file '{destination_file}' is not a .txt file."
assert os.path.exists(source_file), (
f"Error: Source file '{source_file}' doesn't exist."
)
assert source_file.endswith(".txt"), (
f"Error: Source file '{source_file}' is not a .txt file."
)
assert destination_file.endswith(".txt"), (
f"Error: Destination file '{destination_file}' is not a .txt file."
)

# Copy operation: Open the source file in read mode
with open(source_file, "r", encoding="utf-8") as file_from:
Expand Down
5 changes: 0 additions & 5 deletions solutions/tests/test_fuel_gauge.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@ def test_full(self):
self.assertEqual(fuel_gauge(90, 100), "F")

def test_empty(self):
<<<<<<< HEAD
"""Test cases where the percentage is 10%
or less it should result E."""
self.assertEqual(fuel_gauge(10, 100), "E")
=======
"""Test cases where the percentage is 10% or less it should result E."""
>>>>>>> 30d157832e3def89289453b26ff2fdd600bc5e6e
self.assertEqual(fuel_gauge(0, 100), "E")

def test_percentage(self):
"""Test cases where the result is between 90 and 10 it should be M."""
Expand Down
6 changes: 3 additions & 3 deletions solutions/word_count_from_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def word_count_txt_file(file_name) -> int:

# Defensive assertions
assert os.path.exists(file_name), f"Error:file '{file_name}' doesn't exist"
assert file_name.endswith(
".txt"
), f"Error: The file '{file_name}' does not have a .txt extension."
assert file_name.endswith(".txt"), (
f"Error: The file '{file_name}' does not have a .txt extension."
)

# Open the file safely
f = open(file_name, "r", encoding="utf-8")
Expand Down

0 comments on commit 7f81407

Please sign in to comment.