-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a base Command object defining core command behavior.
- Loading branch information
Showing
3 changed files
with
29 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,3 @@ | ||
# Copyright (c) 2016, Matt Layman | ||
|
||
from .base import Command # NOQA |
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,13 @@ | ||
# Copyright (c) 2016, Matt Layman | ||
|
||
|
||
class Command(object): | ||
"""A command class with the minimal interface required for each command.""" | ||
|
||
@classmethod | ||
def register(cls, parser): | ||
"""Register required options. | ||
The provided parser is a subparser from ``subparsers.add_parser``. | ||
""" | ||
raise NotImplementedError() |
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,13 @@ | ||
# Copyright (c) 2016, Matt Layman | ||
|
||
import mock | ||
|
||
from handroll.commands import Command | ||
from handroll.tests import TestCase | ||
|
||
|
||
class TestCommand(TestCase): | ||
|
||
def test_register_not_implemented(self): | ||
parser = mock.Mock() | ||
self.assertRaises(NotImplementedError, Command.register, parser) |