aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2022-06-17 17:37:39 +0900
committer坂本 貴史 <o-takashi@sakamocchi.jp>2022-06-19 18:56:37 +0900
commit7362318dc5460c7656c0ef6a4ae6945cc691f9ed (patch)
tree93d519d8615b8bef351a32dcc5ebb22df393a869
parent377c6ef9d992c90de00ec984a6c3a72d2c02d523 (diff)
downloadlibhinoko-7362318dc5460c7656c0ef6a4ae6945cc691f9ed.tar.gz
tests: test object type instead of its instance
No need to instantiate object to test. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r--tests/cycle-timer4
-rw-r--r--tests/fw-iso-resource-auto4
-rw-r--r--tests/fw-iso-resource-once4
-rwxr-xr-xtests/fw-iso-rx-multiple4
-rwxr-xr-xtests/fw-iso-rx-single4
-rwxr-xr-xtests/fw-iso-tx4
-rw-r--r--tests/helper.py10
7 files changed, 17 insertions, 17 deletions
diff --git a/tests/cycle-timer b/tests/cycle-timer
index 0fd8dbb..f011ae1 100644
--- a/tests/cycle-timer
+++ b/tests/cycle-timer
@@ -9,7 +9,7 @@ import gi
gi.require_version('Hinoko', '0.0')
from gi.repository import Hinoko
-target = Hinoko.CycleTimer
+target_type = Hinoko.CycleTimer
methods = (
'new',
'get_timestamp',
@@ -17,5 +17,5 @@ methods = (
'get_cycle_timer',
)
-if not test_struct(target, methods):
+if not test_struct(target_type, methods):
exit(ENXIO)
diff --git a/tests/fw-iso-resource-auto b/tests/fw-iso-resource-auto
index 632c0c5..d5cb3d4 100644
--- a/tests/fw-iso-resource-auto
+++ b/tests/fw-iso-resource-auto
@@ -9,7 +9,7 @@ import gi
gi.require_version('Hinoko', '0.0')
from gi.repository import Hinoko
-target = Hinoko.FwIsoResourceAuto()
+target_type = Hinoko.FwIsoResourceAuto
props = (
'is-allocated',
'channel',
@@ -34,6 +34,6 @@ signals = (
#'deallocated',
)
-if not test_object(target, props, methods, vmethods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
exit(ENXIO)
diff --git a/tests/fw-iso-resource-once b/tests/fw-iso-resource-once
index 770105f..44e2ccd 100644
--- a/tests/fw-iso-resource-once
+++ b/tests/fw-iso-resource-once
@@ -9,7 +9,7 @@ import gi
gi.require_version('Hinoko', '0.0')
from gi.repository import Hinoko
-target = Hinoko.FwIsoResourceOnce()
+target_type = Hinoko.FwIsoResourceOnce
props = (
'generation',
)
@@ -32,6 +32,6 @@ signals = (
)
-if not test_object(target, props, methods, vmethods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
exit(ENXIO)
diff --git a/tests/fw-iso-rx-multiple b/tests/fw-iso-rx-multiple
index 8822ff7..a97a354 100755
--- a/tests/fw-iso-rx-multiple
+++ b/tests/fw-iso-rx-multiple
@@ -9,7 +9,7 @@ import gi
gi.require_version('Hinoko', '0.0')
from gi.repository import Hinoko
-target = Hinoko.FwIsoRxMultiple()
+target_type = Hinoko.FwIsoRxMultiple
props = (
'channels',
)
@@ -30,5 +30,5 @@ signals = (
'interrupted',
)
-if not test_object(target, props, methods, vmethods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
exit(ENXIO)
diff --git a/tests/fw-iso-rx-single b/tests/fw-iso-rx-single
index 5753361..7fff430 100755
--- a/tests/fw-iso-rx-single
+++ b/tests/fw-iso-rx-single
@@ -9,7 +9,7 @@ import gi
gi.require_version('Hinoko', '0.0')
from gi.repository import Hinoko
-target = Hinoko.FwIsoRxSingle()
+target_type = Hinoko.FwIsoRxSingle
props = ()
methods = (
'new',
@@ -29,5 +29,5 @@ signals = (
'interrupted',
)
-if not test_object(target, props, methods, vmethods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
exit(ENXIO)
diff --git a/tests/fw-iso-tx b/tests/fw-iso-tx
index 6dcac87..d6cb768 100755
--- a/tests/fw-iso-tx
+++ b/tests/fw-iso-tx
@@ -9,7 +9,7 @@ import gi
gi.require_version('Hinoko', '0.0')
from gi.repository import Hinoko
-target = Hinoko.FwIsoTx()
+target_type = Hinoko.FwIsoTx
props = ()
methods = (
'new',
@@ -28,5 +28,5 @@ signals = (
'interrupted',
)
-if not test_object(target, props, methods, vmethods, signals):
+if not test_object(target_type, props, methods, vmethods, signals):
exit(ENXIO)
diff --git a/tests/helper.py b/tests/helper.py
index b845a70..0bb6b5b 100644
--- a/tests/helper.py
+++ b/tests/helper.py
@@ -2,21 +2,21 @@ import gi
gi.require_version('GObject', '2.0')
from gi.repository import GObject
-def test_object(target, props, methods, vmethods, signals) ->bool:
- labels = [prop.name for prop in target.props]
+def test_object(target_type, props, methods, vmethods, signals) ->bool:
+ labels = [prop.name for prop in target_type.props]
for prop in props:
if prop not in labels:
print('Property {0} is not produced.'.format(prop))
return False
for method in methods:
- if not hasattr(target, method):
+ if not hasattr(target_type, method):
print('Method {0} is not produced.'.format(method))
return False
for vmethod in vmethods:
- if not hasattr(target, method):
+ if not hasattr(target_type, method):
print('Vmethod {0} is not produced.'.format(vmethod))
return False
- labels = GObject.signal_list_names(target)
+ labels = GObject.signal_list_names(target_type)
for signal in signals:
if signal not in labels:
print('Signal {0} is not produced.'.format(signal))