Skip to content

Commit

Permalink
Merge pull request #118 from gisce/fix_tests
Browse files Browse the repository at this point in the history
FIX - Fix tests
  • Loading branch information
tinogis authored Oct 28, 2024
2 parents 68c9d39 + 9404b76 commit b2e6c0f
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 21 deletions.
22 changes: 11 additions & 11 deletions primestg/report/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from primestg.message import MessageS
from primestg.utils import octet2name, octet2number

SUPPORTED_REPORTS = ['S02', 'S04', 'S05', 'S06', 'S09', 'S12', 'S13', 'S14', 'S15',
'S17', 'S18', 'S23', 'S24', 'S27', 'S42', 'S52']
SUPPORTED_REPORTS = ['S01', 'S02', 'S04', 'S05', 'S06', 'S09', 'S12', 'S13', 'S14', 'S15',
'S17', 'S18', 'S21', 'S23', 'S24', 'S26', 'S27', 'S42', 'S52']


def is_supported(report_code):
Expand Down Expand Up @@ -154,34 +154,34 @@ def values(self):
'timestamp': self._get_timestamp('Fh'),
'season': self.objectified.get('Fh')[-1:],
'active_quadrant': get_integer_value(temp_values.get('Ca', 0)),
'current_sum_3_phases': get_integer_value(temp_values.get('I3', 0.0)),
'current_sum_3_phases': get_float_value(temp_values.get('I3', 0.0)),

'voltage1': get_integer_value(temp_values.get('L1v', 0.0)),
'current1': get_integer_value(temp_values.get('L1i', 0.0)),
'voltage1': get_integer_value(temp_values.get('L1v', 0)),
'current1': get_float_value(temp_values.get('L1i', 0.0)),
'active_power_import1': get_integer_value(temp_values.get('Pimp', 0)),
'active_power_export1': get_integer_value(temp_values.get('Pexp', 0)),
'reactive_power_import1': get_integer_value(temp_values.get('Qimp', 0)),
'reactive_power_export1': get_integer_value(temp_values.get('Qexp', 0)),
'power_factor1': get_integer_value(temp_values.get('PF', 0.0)),
'power_factor1': get_float_value(temp_values.get('PF', 0.0)),
'active_quadrant_phase1': 0,

'voltage2': get_integer_value(temp_values.get('L2v', 0.0)),
'current2': get_integer_value(temp_values.get('L2i', 0.0)),
'voltage2': get_integer_value(temp_values.get('L2v', 0)),
'current2': get_float_value(temp_values.get('L2i', 0.0)),
'active_power_import2': 0,
'active_power_export2': 0,
'reactive_power_import2': 0,
'reactive_power_export2': 0,
'power_factor2': 0.0,
'active_quadrant_phase2': 0,

'voltage3': get_integer_value(temp_values.get('L3v', 0.0)),
'current3': get_integer_value(temp_values.get('L3i', 0.0)),
'voltage3': get_integer_value(temp_values.get('L3v', 0)),
'current3': get_float_value(temp_values.get('L3i', 0.0)),
'active_power_import3': 0,
'active_power_export3': 0,
'reactive_power_import3': 0,
'reactive_power_export3': 0,
'power_factor3': 0.0,
'active_quadrant_phase3': 0.0,
'active_quadrant_phase3': 0,

'phase_presence': [get_integer_value(i) for i in (temp_values.get('PP', '0')).split(",")],
'meter_phase': get_integer_value(temp_values.get('Fc', 0)),
Expand Down
3 changes: 2 additions & 1 deletion spec/Order_B02_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
'id_pet': str(1234),
'id_req': 'B02',
'cnc': 'CIR000000000',
'cnt': 'CNT000000000'
'cnt': 'CNT000000000',
'version': '3.1.c'
}
payload = {
'activation_date': datetime(2021, 4, 1),
Expand Down
3 changes: 2 additions & 1 deletion spec/Order_B07_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
'id_pet': '1234',
'id_req': 'B07',
'cnc': 'CIR000000000',
'version': '3.1.c'
}
payload = {
'IPftp': '10.1.5.206',
}
order = Order('B07_ipftp')
order = Order('B07_ip')
order = order.create(generic_values, payload)
expect(order).to(equal(expected_result))
1 change: 1 addition & 0 deletions spec/Report_S01_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
expected_first_value_first_meter = [
{
'timestamp': '2019-10-15 15:26:17',
'season': 'S',
'voltage': 230,
'current': 0.0,
'active_power_import': 1870,
Expand Down
1 change: 1 addition & 0 deletions spec/Report_S21_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
expected_first_value_first_meter = [
{
'timestamp': '2019-10-15 15:27:14',
'season': 'S',
'active_quadrant': 4,
'current_sum_3_phases': 8.2,

Expand Down
7 changes: 4 additions & 3 deletions spec/Report_S26_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
expected_first_value_first_meter = [
{
'timestamp': '2024-09-09 11:58:58',
'season': 'S',
'active_quadrant': 0,
'current_sum_3_phases': 23.0,

Expand All @@ -33,7 +34,7 @@
'power_factor1': 0.0,
'active_quadrant_phase1': 0,

'voltage2': 0.0,
'voltage2': 0,
'current2': 0.0,
'active_power_import2': 0,
'active_power_export2': 0,
Expand All @@ -42,7 +43,7 @@
'power_factor2': 0.0,
'active_quadrant_phase2': 0,

'voltage3': 0.0,
'voltage3': 0,
'current3': 0.0,
'active_power_import3': 0,
'active_power_export3': 0,
Expand Down Expand Up @@ -90,4 +91,4 @@
result.append(value)
if meter.warnings:
warnings.append(meter.warnings)
expect(result).to(equal(expected_result))
expect(result).to(equal(expected_result))
1 change: 1 addition & 0 deletions spec/data/S01.xml_result.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
'timestamp': '2019-10-15 15:26:17',
'season': 'S',
'voltage': 230,
'current': 0.0,
'active_power_import': 1870,
Expand Down
1 change: 1 addition & 0 deletions spec/data/S21.xml_result.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
'timestamp': '2019-10-15 15:27:14',
'season': 'S',
'active_quadrant': 4,
'current_sum_3_phases': 8.2,

Expand Down
2 changes: 1 addition & 1 deletion spec/data/S21_with_error.xml_result.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[{'meter_phase': 5, 'ae': 0, 'ai': 254, 'voltage2': 0, 'voltage3': 0, 'voltage1': 236, 'current_switch_state': 1, 'cnc_name': 'ZIV0004394488', 'current_sum_3_phases': 0.0, 'power_factor1': 1.0, 'active_power_import2': 0, 'name': 'ZIV0040318130', 'reactive_power_import1': 0, 'reactive_power_import3': 0, 'reactive_power_import2': 0, 'active_power_export3': 0, 'active_power_export2': 0, 'active_power_export1': 0, 'timestamp': '2019-10-16 13:27:00', 'power_factor2': 0, 'power_factor3': 0, 'reactive_power_export2': 0, 'reactive_power_export3': 0, 'active_quadrant_phase3': 0, 'active_quadrant_phase2': 0, 'active_power_import1': 450, 'active_quadrant': 1, 'active_power_import3': 0, 'current1': 1.9, 'current3': 0.0, 'current2': 0.0, 'r4': 0, 'active_quadrant_phase1': 1, 'r1': 274, 'r2': 0, 'r3': 0, 'previous_switch_state': 0, 'reactive_power_export1': 0, 'phase_presence': [4]}]
[{'meter_phase': 5, 'ae': 0, 'ai': 254, 'voltage2': 0, 'voltage3': 0, 'voltage1': 236, 'current_switch_state': 1, 'cnc_name': 'ZIV0004394488', 'current_sum_3_phases': 0.0, 'power_factor1': 1.0, 'active_power_import2': 0, 'name': 'ZIV0040318130', 'reactive_power_import1': 0, 'reactive_power_import3': 0, 'reactive_power_import2': 0, 'active_power_export3': 0, 'active_power_export2': 0, 'active_power_export1': 0, 'timestamp': '2019-10-16 13:27:00', 'season': 'S', 'power_factor2': 0, 'power_factor3': 0, 'reactive_power_export2': 0, 'reactive_power_export3': 0, 'active_quadrant_phase3': 0, 'active_quadrant_phase2': 0, 'active_power_import1': 450, 'active_quadrant': 1, 'active_power_import3': 0, 'current1': 1.9, 'current3': 0.0, 'current2': 0.0, 'r4': 0, 'active_quadrant_phase1': 1, 'r1': 274, 'r2': 0, 'r3': 0, 'previous_switch_state': 0, 'reactive_power_export1': 0, 'phase_presence': [4]}]

10 changes: 6 additions & 4 deletions spec/data/S26_result.txt → spec/data/S26.xml_result.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
'timestamp': '2024-09-09 11:58:58',
'season': 'S',
'active_quadrant': 0,
'current_sum_3_phases': 23.0,

Expand All @@ -13,7 +14,7 @@
'power_factor1': 0.0,
'active_quadrant_phase1': 0,

'voltage2': 0.0,
'voltage2': 0,
'current2': 0.0,
'active_power_import2': 0,
'active_power_export2': 0,
Expand All @@ -22,7 +23,7 @@
'power_factor2': 0.0,
'active_quadrant_phase2': 0,

'voltage3': 0.0,
'voltage3': 0,
'current3': 0.0,
'active_power_import3': 0,
'active_power_export3': 0,
Expand All @@ -47,6 +48,7 @@
},
{
'timestamp': '2024-09-09 12:00:14',
'season': 'S',
'active_quadrant': 0,
'current_sum_3_phases': 23.1,

Expand All @@ -59,7 +61,7 @@
'power_factor1': 0.0,
'active_quadrant_phase1': 0,

'voltage2': 0.0,
'voltage2': 0,
'current2': 0.0,
'active_power_import2': 0,
'active_power_export2': 0,
Expand All @@ -68,7 +70,7 @@
'power_factor2': 0.0,
'active_quadrant_phase2': 0,

'voltage3': 0.0,
'voltage3': 0,
'current3': 0.0,
'active_power_import3': 0,
'active_power_export3': 0,
Expand Down

0 comments on commit b2e6c0f

Please sign in to comment.