-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from undertherain/dev
Dev
- Loading branch information
Showing
4 changed files
with
52 additions
and
26 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
"""Version of contextfree package.""" | ||
|
||
VERSION = "0.2.1" | ||
VERSION = "0.2.2" |
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
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
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 |
---|---|---|
@@ -1,16 +1,34 @@ | ||
"""Unittests for rule feature""" | ||
|
||
import logging | ||
import unittest | ||
from contextfree.contextfree import init, register_rule, call_rule | ||
|
||
|
||
@register_rule("wall", 1) | ||
def rule(): | ||
print("I am a rule") | ||
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.DEBUG) | ||
|
||
|
||
class Tests(unittest.TestCase): | ||
# pylint: disable=E0102 | ||
@register_rule(1) | ||
def wall(): | ||
"""example of one instance of a rule""" | ||
print("I am a rule 1") | ||
|
||
|
||
def test_rnd(self): | ||
# pylint: disable=E0102 | ||
@register_rule(1) | ||
def wall(): | ||
"""example of another instance of a rule""" | ||
print("I am a rule 2") | ||
|
||
|
||
# pylint: disable=E1121 | ||
class Tests(unittest.TestCase): | ||
"""The actual unittest class""" | ||
def test_rule(self): | ||
"""envoking the rule""" | ||
init(face_color="#123456", background_color="#aaaaaa") | ||
call_rule("wall") | ||
with self.assertRaises(RuntimeError): | ||
rule() | ||
wall() | ||
with self.assertRaises(NotImplementedError): | ||
wall("wrong") |