-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |