Skip to content

Commit b6a1187

Browse files
authored
Merge pull request #46 from FlysonBot/dev
test: add and improve test
2 parents bcc58a1 + 81aa8c9 commit b6a1187

39 files changed

+174
-178
lines changed
Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
on: ["push", "pull_request"]
22

3-
name: Coveralls Test Coverage
3+
name: Update Test Coverage
44

55
permissions:
66
contents: read
@@ -24,11 +24,21 @@ jobs:
2424
pip install -r src/requirements.txt
2525
pip install coveralls
2626
pip install pytest
27-
28-
- name: Run Coverall
27+
28+
- name: Generate Coverage Report
2929
env:
3030
PYTHONPATH: ./src
31-
GITHUB_TOKEN: ${{ secrets. GITHUB_TOKEN }}
3231
run: |
3332
coverage run -m pytest tests/
34-
coveralls
33+
coverage xml
34+
35+
- name: Upload Report to Coveralls
36+
env:
37+
GITHUB_TOKEN: ${{ secrets. GITHUB_TOKEN }}
38+
run: coveralls
39+
40+
- name: Upload Report to Codacy
41+
uses: codacy/[email protected]
42+
with:
43+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
44+
coverage-reports: coverage.xml

.github/workflows/ossf_scorecard.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ on:
33
push:
44
branches:
55
- main
6-
pull_request_target:
7-
branches:
8-
- main
96
workflow_dispatch:
107

118
permissions: read-all

examples/install.sh

100755100644
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ check_python() {
44
# Check for Python installation
55
if ! command -v python3 &>/dev/null; then
66
echo "Python is not installed."
7-
read -p "Do you want to install Python 3.10.12? (y/n): " install_python
7+
read -r -p "Do you want to install Python 3.10.12? (y/n): " install_python
88
if [[ "$install_python" == "y" ]]; then
99
install_python
1010
else
@@ -15,7 +15,7 @@ check_python() {
1515
PYTHON_VERSION=$(python3 --version | grep -oP '\d+\.\d+')
1616
if (( $(echo "$PYTHON_VERSION < 3.10" | bc -l) )); then
1717
echo "Python version is less than 3.10."
18-
read -p "Do you want to update to Python 3.10.12? (y/n): " update_python
18+
read -r -p "Do you want to update to Python 3.10.12? (y/n): " update_python
1919
if [[ "$update_python" == "y" ]]; then
2020
install_python
2121
else
@@ -52,7 +52,7 @@ check_mastermind_ai() {
5252
else
5353
echo "mastermind-ai is already installed."
5454
if pip list --outdated | grep mastermind-ai &>/dev/null; then
55-
read -p "An update for mastermind-ai is available. Do you want to update it? (y/n): " update_package
55+
read -r -p "An update for mastermind-ai is available. Do you want to update it? (y/n): " update_package
5656
if [[ "$update_package" == "y" ]]; then
5757
pip install --upgrade mastermind-ai
5858
fi

src/mastermind/game/board.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ class EmptyBoardError(Exception):
2525
Exception raised when trying to access the game board when it is empty.
2626
"""
2727

28-
pass
29-
3028
def __init__(self, number_of_colors: int, number_of_dots: int) -> None:
3129
self.NUMBER_OF_COLORS = number_of_colors
3230
self.NUMBER_OF_DOTS = number_of_dots

src/mastermind/ui/menu/base_menu.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def name(self) -> str:
1818
1919
This is an abstract property that must be implemented by subclasses.
2020
"""
21-
pass
2221

2322
@property
2423
def width(self) -> int:
@@ -52,7 +51,6 @@ def _print_content(self) -> None:
5251
5352
This is an abstract method that must be implemented by subclasses.
5453
"""
55-
pass
5654

5755
def _print_separator(self) -> None:
5856
"""

src/mastermind/ui/menu/data_menu.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def _fetch_data(self) -> Optional[Any]:
2828
2929
This is an abstract method that must be implemented by subclasses.
3030
"""
31-
pass
3231

3332
@abstractmethod
3433
def _render_data(self, data: Any) -> None:
@@ -37,7 +36,6 @@ def _render_data(self, data: Any) -> None:
3736
3837
This is an abstract method that must be implemented by subclasses.
3938
"""
40-
pass
4139

4240
@property
4341
@abstractmethod
@@ -47,4 +45,3 @@ def _empty_message(self) -> str:
4745
4846
This is an abstract property that must be implemented by subclasses.
4947
"""
50-
pass

src/mastermind/ui/menu/resume_game_menu.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ def get_option(self) -> Union[str, int]:
6363
self.display()
6464

6565

66-
def _is_option_valid(option: int, number_of_options: int) -> bool:
67-
return option.isdigit() and 0 <= option <= number_of_options
66+
def _is_option_valid(option: str, number_of_options: int) -> bool:
67+
return option.isdigit() and 0 <= int(option) <= number_of_options

src/mastermind/validation/base/base.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def validate_value(self, value: Any) -> T:
2222
Returns:
2323
T: The validated value.
2424
"""
25-
pass
2625

2726

2827
class ValidationModel(Validator[T], ABC):
@@ -49,7 +48,6 @@ def validate_arguments(self) -> None:
4948
5049
This method must be implemented by subclasses to perform any necessary validation.
5150
"""
52-
pass
5351

5452

5553
class StateValidator(Validator[T], ABC):
@@ -79,7 +77,6 @@ def validate_modifications(self, new_value: Any) -> None:
7977
Raises:
8078
ValidationError: If the new value is invalid.
8179
"""
82-
pass
8380

8481
@property
8582
def value(self) -> T:

src/mastermind/validation/base/exceptions.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,32 @@ class ValidationError(Exception):
33
The base class for all validation-related exceptions.
44
"""
55

6-
pass
7-
86

97
class MissingParameterError(ValidationError):
108
"""
119
Raised when a required parameter is missing.
1210
"""
1311

14-
pass
15-
1612

1713
class TypeValidationError(ValidationError):
1814
"""
1915
Raised when a value does not match the expected type.
2016
"""
2117

22-
pass
23-
2418

2519
class InputConversionError(ValidationError):
2620
"""
2721
Raised when a value cannot be converted to the expected type.
2822
"""
2923

30-
pass
31-
3224

3325
class RangeError(ValidationError):
3426
"""
3527
Raised when a value is outside the expected range.
3628
"""
3729

38-
pass
39-
4030

4131
class InvalidModificationError(ValidationError):
4232
"""
4333
Raised when a modification to a validated value is invalid.
4434
"""
45-
46-
pass

src/mastermind/validation/base/numeric.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ def convert(self, value: str) -> Number:
9090
Raises:
9191
InputConversionError: If the value cannot be converted to the expected numeric type.
9292
"""
93-
pass
9493

9594
def validate_range(self, value: Number) -> None:
9695
"""

0 commit comments

Comments
 (0)