#!/usr/bin/env python3
from sys import exit
+
import gi
gi.require_version('ALSACtl', '0.0')
from gi.repository import ALSACtl
+from helper import test_enums
+
elem_types = (
'NONE',
'BOOLEAN',
ALSACtl.CardError: card_error_types,
}
-for obj, types in types.items():
- for t in types:
- if not hasattr(obj, t):
- print('Enumerator {0} is not produced.'.format(t))
- exit(1)
+for target_type, enumerations in types.items():
+ if not test_enums(target_type, enumerations):
+ exit(1)
#!/usr/bin/env python3
from sys import exit
+
import gi
gi.require_version('ALSAHwdep', '0.0')
from gi.repository import ALSAHwdep
+from helper import test_enums
+
iface_types = (
'OPL2',
'OPL3',
ALSAHwdep.DeviceCommonError: device_common_error_types,
}
-for obj, types in types.items():
- for t in types:
- if not hasattr(obj, t):
- print('Enumerator {0} is not produced.'.format(t))
- exit(1)
+for target_type, enumerations in types.items():
+ if not test_enums(target_type, enumerations):
+ exit(1)
#!/usr/bin/env python3
from sys import exit
+
import gi
gi.require_version('ALSARawmidi', '0.0')
from gi.repository import ALSARawmidi
+from helper import test_enums
+
stream_direction_types = (
'OUTPUT',
'INPUT',
ALSARawmidi.StreamPairError: stream_pair_error_types,
}
-for obj, types in types.items():
- for t in types:
- if not hasattr(obj, t):
- print('Enumerator {0} is not produced.'.format(t))
- exit(1)
+for target_type, enumerations in types.items():
+ if not test_enums(target_type, enumerations):
+ exit(1)
#!/usr/bin/env python3
from sys import exit
+
import gi
gi.require_version('ALSASeq', '0.0')
from gi.repository import ALSASeq
+from helper import test_enums
+
specific_address_types = (
'UNKNOWN',
'SUBSCRIBERS',
'BROADCAST',
)
-specific_client_id_types= (
+specific_client_id_types = (
'SYSTEM',
'DUMMY',
'OSS',
ALSASeq.EventError: event_error_types,
}
-for obj, types in types.items():
- for t in types:
- if not hasattr(obj, t):
- print('Enumerator {0} is not produced.'.format(t))
- exit(1)
+for target_type, enumerations in types.items():
+ if not test_enums(target_type, enumerations):
+ exit(1)
gi.require_version('ALSATimer', '0.0')
from gi.repository import ALSATimer
+from helper import test_enums
+
class_types = (
'NONE',
'GLOBAL',
ALSATimer.UserInstanceError: user_instance_error_types,
}
-for obj, types in types.items():
- for t in types:
- if not hasattr(obj, t):
- print('Enumerator {0} is not produced.'.format(t))
- exit(1)
+for target_type, enumerations in types.items():
+ if not test_enums(target_type, enumerations):
+ exit(1)
print('Signal {0} is not produced.'.format(signal))
return False
return True
+
+
+def test_enums(target_type: object, enumerations: tuple[str]) -> bool:
+ for enumeration in enumerations:
+ if not hasattr(target_type, enumeration):
+ print('Enumeration {0} is not produced for {1}.'.format(
+ enumeration, target_type))
+ return False
+ return True