Skip to content

Commit

Permalink
fix: DiagnosticsReport#get_report_subset
Browse files Browse the repository at this point in the history
Was previously looking up obj attribute instead of
dict item/key.
  • Loading branch information
marvinmarnold committed Nov 11, 2021
1 parent 0020a41 commit c390352
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.11.2
current_version = 0.11.4
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion hm_pyhelper/diagnostics/diagnostics_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def record_failure(self, msg_or_exception, diagnostic):
self.record_result(record_failure_as, diagnostic)

def get_report_subset(self, keys_to_extract):
return {key: self.__getattribute__(key) for key in keys_to_extract}
return {key: self.__getitem__(key) for key in keys_to_extract}

def get_error_messages(self):
def get_error_message(key):
Expand Down
9 changes: 9 additions & 0 deletions hm_pyhelper/tests/test_diagnostic_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,12 @@ def test_get_error_messages(self):
actual_msgs = diagnostics_report.get_error_messages()
expected_msgs = "key1 Error: Error1\nkey2 Error: Error2"
self.assertEqual(actual_msgs, expected_msgs)

def test_get_report_subset(self):
diagnostics_report = DiagnosticsReport()
diagnostics_report['VA'] = 'NEBHNT-IN1'
diagnostics_report['foo'] = 'bar'

self.assertDictEqual(diagnostics_report.get_report_subset(["VA"]), {
'VA': 'NEBHNT-IN1'
})
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='hm_pyhelper',
version='0.11.3',
version='0.11.4',
author="Nebra Ltd",
author_email="[email protected]",
description="Helium Python Helper",
Expand Down

0 comments on commit c390352

Please sign in to comment.