Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/templates/enums.py.mako
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ config = template_parameters['metadata'].config
enums = config['enums']
%>
from enum import Enum
% if any(enums[e].get('enum_class', 'Enum') == 'IntFlag' for e in enums):
% if any(enums[e].get('class', 'Enum') == 'IntFlag' for e in enums):
from enum import IntFlag
% endif
% for enum_name in sorted(helper.filter_codegen_enums(enums)):


class ${enums[enum_name]['python_name']}(${enums[enum_name].get('enum_class', 'Enum')}):
class ${enums[enum_name]['python_name']}(${enums[enum_name].get('class', 'Enum')}):
<%
print_list = []
%>\
Expand Down
4 changes: 2 additions & 2 deletions generated/nifake/nifake/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class IntFlagEnum(IntFlag):
r'''
Flag B option.
'''
C = 9223372036854775808
E = 1073741824
r'''
Flag C option.
Flag E option.
'''


Expand Down
4 changes: 2 additions & 2 deletions generated/nifake/nifake/unit_tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,12 +839,12 @@ def test_return_timedeltas(self):
self.patched_library_interpreter.return_list_of_durations_in_seconds.assert_called_once_with(len(time_values))

def test_with_valid_intflag_parameter(self):
flags = nifake.IntFlagEnum.C | nifake.IntFlagEnum.A
flags = nifake.IntFlagEnum.E | nifake.IntFlagEnum.A
self.patched_library_interpreter.function_with_intflag_parameter.side_effect = None
self.patched_library_interpreter.function_with_intflag_parameter.return_value = None
with nifake.Session('dev1') as session:
session.function_with_intflag_parameter(flags)
self.patched_library_interpreter.function_with_intflag_parameter.assert_called_once_with(9223372036854775809)
self.patched_library_interpreter.function_with_intflag_parameter.assert_called_once_with(1073741825)

def test_with_intflag_parameter_invalid(self):
invalid_flag = 5
Expand Down
8 changes: 4 additions & 4 deletions src/nifake/metadata/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@
]
},
'IntFlagEnum': {
'class': 'IntFlag',
'codegen_method': 'public',
'enum_class': 'IntFlag',
'values': [
{
'documentation': {
Expand All @@ -259,10 +259,10 @@
},
{
'documentation': {
'description': 'Flag C option.'
'description': 'Flag E option.'
},
'name': 'NIFAKE_VAL_FLAG_C',
'value': 9223372036854775808
'name': 'NIFAKE_VAL_FLAG_E',
'value': 1073741824
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions src/nifake/unit_tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,12 +839,12 @@ def test_return_timedeltas(self):
self.patched_library_interpreter.return_list_of_durations_in_seconds.assert_called_once_with(len(time_values))

def test_with_valid_intflag_parameter(self):
flags = nifake.IntFlagEnum.C | nifake.IntFlagEnum.A
flags = nifake.IntFlagEnum.E | nifake.IntFlagEnum.A
self.patched_library_interpreter.function_with_intflag_parameter.side_effect = None
self.patched_library_interpreter.function_with_intflag_parameter.return_value = None
with nifake.Session('dev1') as session:
session.function_with_intflag_parameter(flags)
self.patched_library_interpreter.function_with_intflag_parameter.assert_called_once_with(9223372036854775809)
self.patched_library_interpreter.function_with_intflag_parameter.assert_called_once_with(1073741825)

def test_with_intflag_parameter_invalid(self):
invalid_flag = 5
Expand Down
4 changes: 2 additions & 2 deletions src/nirfsg/metadata/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@
]
},
'ResetWithOptionsStepsToOmit': {
'enum_class': 'IntFlag',
'class': 'IntFlag',
'values': [
{
'documentation': {
Expand Down Expand Up @@ -1066,7 +1066,7 @@
]
},
'SelfCalibrateRangeStepsToOmit': {
'enum_class': 'IntFlag',
'class': 'IntFlag',
'values': [
{
'documentation': {
Expand Down
Loading