File: test_objects.py

package info (click to toggle)
oarc-dsc-datatool 1.4.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 492 kB
  • sloc: python: 1,151; xml: 859; sh: 125; makefile: 4
file content (68 lines) | stat: -rw-r--r-- 1,560 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
65
66
67
68
import pytest
from dsc_datatool import Dataset, Dimension, Input, Output, Generator, Transformer


def test_dataset():
    o = Dataset()
    assert '%r' % o == '<Dataset name=None dimension=[]>'


def test_dimension():
    o = Dimension('test')
    assert '%r' % o == '<Dimension name=\'test\' value=None dimension=[]>'


def test_input():
    o = Input()
    with pytest.raises(Exception):
        o.process("test")

    class Input1(Input):
        def process(self, file):
            pass
    with pytest.raises(Exception):
        class Input1(Input):
            def process(self, file):
                pass


def test_output():
    o = Output({})
    with pytest.raises(Exception):
        o.process([])

    class Output1(Output):
        def process(self, file):
            pass
    with pytest.raises(Exception):
        class Output1(Output):
            def process(self, file):
                pass


def test_generator():
    o = Generator({})
    with pytest.raises(Exception):
        o.process([])

    class Generator1(Generator):
        def process(self, file):
            pass
    with pytest.raises(Exception):
        class Generator1(Generator):
            def process(self, file):
                pass


def test_transformer():
    o = Transformer({})
    with pytest.raises(Exception):
        o.process([])

    class Transformer1(Transformer):
        def process(self, file):
            pass
    with pytest.raises(Exception):
        class Transformer1(Transformer):
            def process(self, file):
                pass