Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vladistan committed Aug 8, 2024
1 parent 39ea83c commit 9009d12
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 22 deletions.
3 changes: 2 additions & 1 deletion src/greenbutton_objects/atom/href_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ def entry_content_type(entry: EntryType) -> type:

return self

def get_entry_title(self, entry: EntryType) -> str:
@staticmethod
def get_entry_title(entry: EntryType) -> str:
if entry.title:
title_parts = []
for text in entry.title:
Expand Down
3 changes: 1 addition & 2 deletions src/greenbutton_objects/orig_objects/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ class MeterReading:
class UsagePoint:
"""
Logical point on a network at which consumption or production is either
physically measured (e.g., metered) or estimated (e.g., unmetered street
lights).
physically measured (e.g., metered) or estimated (e.g., unmetered streetlights).
:ivar title: The title of the usage point.
:ivar uri: The URI that identifies this usage point in the atom feed
Expand Down
6 changes: 1 addition & 5 deletions src/greenbutton_objects/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,4 @@ def compute_multiplier(reading_type: ReadingType) -> float:
missing_val=UnitMultiplierKindValue.VALUE_0,
)

if reading_type.power_of_ten_multiplier:
multiplier: float = 10.0**reading_power_ten.value
else:
multiplier = 1.0
return multiplier
return 10.0**reading_power_ten.value
17 changes: 3 additions & 14 deletions tests/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import os
import pathlib
from pathlib import Path
from typing import Iterable

import pytest
from greenbutton_objects import parse
Expand All @@ -23,7 +22,7 @@ def _save_representation(test_xml_path: Path, test_output_path: Path) -> None:
Parse an XML feed, generate a representation, and save it to a text
file.
"""
parsed_feed = parse.parse_feed(test_xml_path)
parsed_feed = parse.parse_feed(str(test_xml_path))
representation = parse.parse_feed_representation(parsed_feed)
with open(test_output_path, "w") as f:
f.write(representation)
Expand Down Expand Up @@ -95,20 +94,10 @@ def test_parse_natural_gas_feed(data_file_name):
check_file(Path(data_file_name))


@pytest.fixture()
def electricity_feeds(data_dir) -> Iterable[Path]:
return (data_dir / "electricity").iterdir()


@pytest.fixture()
def natural_gas_feeds(data_dir):
yield from (data_dir / "natural_gas").iterdir()


@pytest.mark.parametrize("energy_source", ["electricity", "natural_gas"])
def test_quick(data_dir, energy_source):
"""
Very quick test that runs only one of of the files from each source
Very quick test that runs only one of the files from each source
"""

files = (data_dir / energy_source).iterdir()
Expand All @@ -126,7 +115,7 @@ def test_quick(data_dir, energy_source):
)
def test_abridged(data_dir, energy_source):
"""
Very quick test that runs only one of of the files from each source
Very quick test that runs only one of the files from each source
"""

files = (data_dir / energy_source).iterdir()
Expand Down

0 comments on commit 9009d12

Please sign in to comment.