Skip to content

Conversation

@JoaquimNetoo
Copy link

Hello, I am a beginner in software testing development and I'm trying to contribute to this project. While analyzing the fetch_consumption method, which is located in /electricitymap/contrib/parsers/VN.py, I noticed that the logical operator 'is' should be changed to the logical operator '==', so I modified the VN.py file. I added a test file named test_VN.py in electricitymap/contrib/parsers/tests which tests the method after changing the logical operators. If this is a mistake, I apologize.

@JoaquimNetoo JoaquimNetoo requested a review from a team as a code owner October 31, 2025 20:35
@github-actions github-actions bot added the python Pull requests that update Python code label Oct 31, 2025
Copy link
Member

@VIKTORVAV99 VIKTORVAV99 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR but I fail to understand what you are actually trying to test since you are creating a class of ZoneKey instead of using the ZoneKey type.

Comment on lines +12 to +18
class ZoneKey:
def __init__(self, zone): self.zone = zone
def __eq__(self, other):
if isinstance(other, ZoneKey): return self.zone == other.zone
return self.zone == other
def __hash__(self): return hash(self.zone)
def __str__(self): return self.zone
Copy link
Member

Choose a reason for hiding this comment

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

Why is this a class?

ZoneKey is just a type alias of str to help with type flows.

Comment on lines +29 to +38
def mock_dependencies(mocker):

mocker.patch(f"{PATCH_PATH}.datetime", mocker.MagicMock(wraps=datetime))
mocker.patch(f"{PATCH_PATH}.datetime.now", return_value=MOCKED_NOW)
mocker.patch(f"{PATCH_PATH}.timedelta", timedelta)

mocker.patch(f"{PATCH_PATH}.fetch_live_consumption", autospec=True)
mocker.patch(f"{PATCH_PATH}.fetch_historical_consumption", autospec=True)

mocker.patch(f"{PATCH_PATH}.Session")
Copy link
Member

Choose a reason for hiding this comment

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

Dependencies should not be mocked.

mocker.patch(f"{PATCH_PATH}.Session")

def test_ct1_live_data_valida(mocker):
expected_data = [{"time": "now"}]
Copy link
Member

Choose a reason for hiding this comment

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

What is this supposed to test?

We don't have any data in this format?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants