< Summary

Class:mineitem.py
Assembly:src.minesweeper
File(s):/home/runner/work/kata-python-minesweeper5/kata-python-minesweeper5/src/minesweeper/mineitem.py
Covered lines:26
Uncovered lines:0
Coverable lines:26
Total lines:32
Line coverage:100% (26 of 26)
Covered branches:12
Total branches:12
Branch coverage:100% (12 of 12)
Tag:20_659826003

File(s)

/home/runner/work/kata-python-minesweeper5/kata-python-minesweeper5/src/minesweeper/mineitem.py

#LineLine coverage
 11class MineItem:
 12    _is_bomb: bool = False
 13    _is_cover: bool = True
 14    near_bombs_count: int = 0
 5
 16    def __init__(self, near_items=()):
 17        self.near_items = near_items
 8
 19    def set_bomb(self):
 110        self._is_bomb = True
 111        for item in self.near_items:
 112            item.near_bombs_count += 1
 13
 114    @property
 115    def is_bomb(self):
 116        return self._is_bomb
 17
 118    def __str__(self):
 119        if self._is_cover:
 120            return "."
 121        if self.is_bomb:
 122            return "*"
 123        return str(self.near_bombs_count)
 24
 125    def click(self):
 126        if self._is_cover is False:
 127            return
 128        self._is_cover = False
 29
 130        if self.near_bombs_count is 0:
 131            for item in self.near_items:
 132                item.click()

Methods/Properties