Skip to content

Commit

Permalink
added init tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrabal committed Dec 15, 2018
1 parent 93a0741 commit cac4109
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class TestClass:
callable_cls = True
command = 'test'

def _base(self):
pass
33 changes: 33 additions & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
"""
@author: Federico Cerchiari <federicocerchiari@gmail.com>
"""
import os
import sys
import unittest
import argparse
sys.path.append(os.getcwd())
from classcli import CliBuilder


class TestClass:
callable_cls = True
command = 'test'

def _base(self):
pass


class TestInit(unittest.TestCase):
def test_from_list(self):
inst = CliBuilder([TestClass, ])
self.assertIsInstance(inst.parser, argparse.ArgumentParser)

def test_from_dict(self):
inst = CliBuilder({'test_class': TestClass})
self.assertIsInstance(inst.parser, argparse.ArgumentParser)

def test_from_module(self):
from tests import module
inst = CliBuilder(module)
self.assertIsInstance(inst.parser, argparse.ArgumentParser)

0 comments on commit cac4109

Please sign in to comment.