Skip to content

Commit

Permalink
Initial example of unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed May 5, 2023
1 parent f706b05 commit de8c888
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
34 changes: 34 additions & 0 deletions CHAP/test/common/reader_t.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""
File : common/reader.py
Author : Valentin Kuznetsov <vkuznet AT gmail dot com>
Description: Unit tests for common/reader.py code
"""

# system modules
import time
import unittest

# local modules
from CHAP.common import YAMLReader


class CommonReaderTest(unittest.TestCase):
"""Unit test for common/reader.py module"""

def setUp(self):
self.fname = '/'.join(__file__.split("/")[:-2]) + '/data/file.yaml'
self.reader = YAMLReader()

def tierDown(self):
pass

def testReader(self):
"""
Unit test to test reader
"""
data = self.reader.read(self.fname)
self.assertEqual(isinstance(data, dict), True)


if __name__ == '__main__':
unittest.main()
2 changes: 2 additions & 0 deletions CHAP/test/data/file.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
file: 1
name: "bla"

0 comments on commit de8c888

Please sign in to comment.