File: test_python_has_cur_dataset_attribute.py

package info (click to toggle)
cmor 3.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 16,856 kB
  • sloc: ansic: 27,460; f90: 14,115; python: 11,636; sh: 3,501; makefile: 420; xml: 168
file content (34 lines) | stat: -rw-r--r-- 920 bytes parent folder | download | duplicates (5)
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
# pylint: disable = missing-docstring, invalid-name
"""
Tests for ``cmor.has_cur_dataset_attribute``.
"""
import os
import unittest

import cmor


class TestHasCurDatasetAttribute(unittest.TestCase):
    """
    Tests for ``cmor.has_cur_dataset_attribute``.
    """

    def setUp(self):
        self.logfile = 'has_cur_dataset_attribute.log'
        cmor.setup(logfile=self.logfile)
        cmor.set_cur_dataset_attribute('valid_attribute', 'valid_value')

    def test_has_cur_dataset_attribute_with_valid_attribute(self):
        self.assertTrue(cmor.has_cur_dataset_attribute('valid_attribute'))

    def test_has_cur_dataset_attribute_with_invalid_attribute(self):
        self.assertFalse(cmor.has_cur_dataset_attribute('invalid_attribute'))

    def tearDown(self):
        cmor.close()
        if os.path.isfile(self.logfile):
            os.remove(self.logfile)


if __name__ == '__main__':
    unittest.main()