[go: up one dir, main page]

File: test_lib.py

package info (click to toggle)
luma.core 2.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,040 kB
  • sloc: python: 6,186; makefile: 204
file content (44 lines) | stat: -rw-r--r-- 716 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017-18 Richard Hull and contributors
# See LICENSE.rst for details.


from luma.core.lib import spidev, rpi_gpio


@rpi_gpio
class RpiGpioTest(object):
    pass


@spidev
class SpiDevTest(object):
    pass


@spidev
@rpi_gpio
class MultiLibTest(object):
    pass


def assertMethod(obj, method):
    assert hasattr(obj, method)
    assert callable(getattr(obj, method))


def test_rpio_gpio():
    t = RpiGpioTest()
    assertMethod(t, '__rpi_gpio__')


def test_spidev():
    t = SpiDevTest()
    assertMethod(t, '__spidev__')


def test_multi():
    t = MultiLibTest()
    for method in ['__spidev__', '__rpi_gpio__']:
        assertMethod(t, method)