Example #1
0
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
## 
## You should have received a copy of the GNU General Public License along
## with this program. If not, see <http:##www.gnu.org#licenses#>.
##
###############################################################################

import unittest
import subprocess

from ginkgo_tests import get_logger
from ginkgo_tests import get_ginkgo_program_path
from ginkgo_tests import run_program

_LOG = get_logger("test_cmdopts")

class CmdOptsTest(unittest.TestCase):
    def setUp(self):
        self.prog_path = get_ginkgo_program_path("test_cmdopt")
        
    def check_opts_parsing(self, cmd, expected_strings):  
        _LOG.info('Testing arguments parsing: "%s"' % cmd)
        stdout, stderr, returncode = run_program(cmd)
        assert returncode == 0, "Program exited with error code %d:\n%s" % (p1.returncode, stderr)
        stdout = stdout.split("\n")        
        for idx, expected in enumerate(expected_strings):
            _LOG.info('Line %d: %s (correct = "%s")' % (idx+1, stdout[idx], expected))        
            assert stdout[idx] == expected, \
                'Expecting "%s", but found "%s" in line %d of stdout' \
                % (expected, stdout[idx], idx+1)
## (at your option) any later version.
## 
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
## 
## You should have received a copy of the GNU General Public License along
## with this program. If not, see <http:##www.gnu.org#licenses#>.
##
###############################################################################

import unittest
from ginkgo_tests import get_logger
from ginkgo_tests import get_ginkgo_program_path
from ginkgo_tests import run_program
from ginkgo_tests import run_external_tests

_LOG = get_logger("test_asciigrid")

class TextUtilsTest(unittest.TestCase):

    def setUp(self):
        self.prog_path = get_ginkgo_program_path("test_asciigrid")

    def testTextUtils(self):
        run_external_tests(self.prog_path, _LOG, "ASCII Grid parsing tests")       
            
if __name__ == "__main__":
    unittest.main()
    
Example #3
0
##
###############################################################################

import unittest
import subprocess

from ginkgo_tests import get_logger
from ginkgo_tests import get_ginkgo_program_path
from ginkgo_tests import run_program
from ginkgo_tests import run_external_tests
import sys
from dendropy import datasets
from dendropy import splits
from dendropy import treedists

_LOG = get_logger("test_tree")

def to_parent_array(tree, include_labels=False, include_edge_lens=False):
    pa = []
    edge_lens = []
    node_pa = {}
    for node in tree.preorder_node_iter():
        node_pa[node] = len(pa)
        if node.parent_node is not None:
            if node.taxon is not None:
                pa.append("%s:'%s'" % (node_pa[node.parent_node], node.taxon.label))
            else:
                pa.append(str(node_pa[node.parent_node]))
        else:
            pa.append(str(-1))
        if include_edge_lens:
Example #4
0
## (at your option) any later version.
## 
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
## 
## You should have received a copy of the GNU General Public License along
## with this program. If not, see <http:##www.gnu.org#licenses#>.
##
###############################################################################

import unittest
from ginkgo_tests import get_logger
from ginkgo_tests import get_ginkgo_program_path
from ginkgo_tests import run_program
from ginkgo_tests import run_external_tests

_LOG = get_logger("test_filesys")

class TextUtilsTest(unittest.TestCase):

    def setUp(self):
        self.prog_path = get_ginkgo_program_path("test_filesys")

    def testTextUtils(self):
        run_external_tests(self.prog_path, _LOG, "filesys tests")       
            
if __name__ == "__main__":
    unittest.main()
    
## (at your option) any later version.
## 
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
## 
## You should have received a copy of the GNU General Public License along
## with this program. If not, see <http:##www.gnu.org#licenses#>.
##
###############################################################################

import unittest
from ginkgo_tests import get_logger
from ginkgo_tests import get_ginkgo_program_path
from ginkgo_tests import run_program
from ginkgo_tests import run_external_tests

_LOG = get_logger("test_textutils")

class TextUtilsTest(unittest.TestCase):

    def setUp(self):
        self.prog_path = get_ginkgo_program_path("test_textutil")

    def testTextUtils(self):
        run_external_tests(self.prog_path, _LOG, "textutils tests")       
            
if __name__ == "__main__":
    unittest.main()