File: exception.py

package info (click to toggle)
aravis 0.8.34-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,028 kB
  • sloc: ansic: 38,758; xml: 1,384; python: 371; sh: 275; makefile: 60; javascript: 58; cpp: 6
file content (64 lines) | stat: -rw-r--r-- 1,453 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# SPDX-License-Identifier:Unlicense

import gi
import os

gi.require_version ('Aravis', '0.8')

from gi.repository import Aravis,GLib

Aravis.set_fake_camera_genicam_filename (os.getenv ('FAKE_GENICAM_PATH'))

Aravis.enable_interface ("Fake")

try:
    camera = Aravis.Camera.new ("NoCamera")

except GLib.Error as err:
    assert err.matches (Aravis.device_error_quark(), Aravis.DeviceError.NOT_FOUND)

camera = Aravis.Camera.new ("Fake_1")

try:
    camera.get_integer ("Width")
    camera.get_integer ("NoFeature")

    assert False # Not reached

    camera.get_integer ("Height")

except GLib.Error as err:
    assert err.matches (Aravis.device_error_quark(), Aravis.DeviceError.FEATURE_NOT_FOUND)

try:
    camera.get_float ("NoFeature")

    assert False # Not reached

except GLib.Error as err:
    assert err.matches (Aravis.device_error_quark(), Aravis.DeviceError.FEATURE_NOT_FOUND)

try:
    camera.get_string ("NoFeature")

    assert False # Not reached

except GLib.Error as err:
    assert err.matches (Aravis.device_error_quark(), Aravis.DeviceError.FEATURE_NOT_FOUND)

try:
    camera.get_boolean ("NoFeature")

    assert False # Not reached

except GLib.Error as err:
    assert err.matches (Aravis.device_error_quark(), Aravis.DeviceError.FEATURE_NOT_FOUND)

value = camera.get_boolean ("TestBoolean")

assert value is False

camera.set_boolean ("TestBoolean", True)
value = camera.get_boolean ("TestBoolean")

assert value is True