File: test_component_list.py

package info (click to toggle)
wsclean 3.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,296 kB
  • sloc: cpp: 129,246; python: 22,066; sh: 360; ansic: 230; makefile: 185
file content (36 lines) | stat: -rw-r--r-- 790 bytes parent folder | download | duplicates (2)
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
import radler as rd
import numpy as np
import pytest


def test_component_list():
    cl = rd.ComponentList()

    # Check defaults
    assert cl.width == 0
    assert cl.height == 0
    assert cl.n_scales == 0
    assert cl.n_frequencies == 0

    with pytest.raises(IndexError):
        cl.component_count(0)


def test_multiscale_component_list():
    WIDTH = 8
    HEIGHT = 9
    N_SCALES = 3
    N_FREQUENCIES = 7

    cl = rd.ComponentList(WIDTH, HEIGHT, N_SCALES, N_FREQUENCIES)

    assert cl.width == WIDTH
    assert cl.height == HEIGHT
    assert cl.n_scales == N_SCALES
    assert cl.n_frequencies == N_FREQUENCIES

    for scale_num in range(N_SCALES):
        assert cl.component_count(scale_num) == 0

    with pytest.raises(IndexError):
        cl.component_count(N_SCALES)