File: test_CSDS.py

package info (click to toggle)
pyxrd 0.8.4-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 7,644 kB
  • sloc: python: 26,501; sh: 301; makefile: 128
file content (55 lines) | stat: -rw-r--r-- 1,276 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
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/python

# coding=UTF-8
# ex:ts=4:sw=4:et=on

# Copyright (c) 2013, Mathijs Dumon
# All rights reserved.
# Complete license can be found in the LICENSE file.

import unittest

import numpy as np

from pyxrd.calculations.data_objects import CSDSData
from pyxrd.calculations.CSDS import calculate_distribution

__all__ = [
    'TestCSDSCalcs',
]

class TestCSDSCalcs(unittest.TestCase):

    def setUp(self):
        self.CSDS_data_kwargs = dict(
            average = 10,
            maximum = 50,
            minimum = 1,
            alpha_scale = 0.9485,
            alpha_offset = 0.017,
            beta_scale = 0.1032,
            beta_offset = 0.0034
        )
        self.CSDS_data = CSDSData(**self.CSDS_data_kwargs)

    def tearDown(self):
        del self.CSDS_data

    def test_not_none(self):
        self.assertIsNotNone(self.CSDS_data)
        
    def test_attributes(self):
        for key, value in self.CSDS_data_kwargs.items():
            self.assertEquals(getattr(self.CSDS_data, key), value)

    def test_calculate_distribution(self):
        result = calculate_distribution(
            self.CSDS_data
        )
        self.assertIsNotNone(result)
        self.assertEquals(len(result), 2)

    pass # end of class


calculate_distribution