示例#1
0
import os
import sys

# spirit_py_dir = os.path.dirname(os.path.realpath(__file__))
spirit_py_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, spirit_py_dir)

from spirit import state, system, configuration

import unittest

##########

cfgfile = spirit_py_dir + "/../test/input/fd_neighbours.cfg"  # Input File
p_state = state.setup(cfgfile)  # State setup


class TestSystem(unittest.TestCase):
    def setUp(self):
        ''' Setup a p_state and copy it to Clipboard'''
        self.p_state = p_state


class SystemGetters(TestSystem):
    def test_get_index(self):
        index = system.get_index(self.p_state)
        self.assertEqual(index, 0)

    def test_get_nos(self):
        nos = system.get_nos(self.p_state)
        self.assertEqual(nos, 4)
示例#2
0
import os
import sys

# spirit_py_dir = os.path.dirname(os.path.realpath(__file__))
spirit_py_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, spirit_py_dir)

from spirit import state, chain, transition

import unittest

##########

p_state = state.setup()  # State setup
chain.Image_to_Clipboard(p_state)  # Copy p_state to Clipboard


class TestTransition(unittest.TestCase):
    def setUp(self):
        ''' Setup a p_state and copy it to Clipboard'''
        self.p_state = p_state
        chain.Insert_Image_After(self.p_state)  # image 1st
        chain.Insert_Image_After(self.p_state)  # image 2nd
        chain.Insert_Image_After(self.p_state)  # image 3rd

    def tearDown(self):
        ''' clean the p_state '''
        noi = chain.Get_NOI(self.p_state)
        for i in range(noi - 1):
            chain.Pop_Back(self.p_state)
        self.assertEqual(chain.Get_NOI(self.p_state), 1)