def test_foo(self): goz = Gozokia() goz.initialize() goz.set_io(input_type="value", output_type="value") value = "foo" self.assertEqual(goz.api(value), "bar") value = "foo" self.assertEqual(goz.api(value), "bar second") value = "foo" self.assertEqual(goz.api(value), "No rules. you said: foo")
def test_greetings(self): goz = Gozokia() goz.rule(name='greeting', type=goz.RAISE_COND, rank=100)(GreetingRaise) goz.initialize() goz.set_io(input_type="value", output_type="value") value = "foo" self.assertEqual(goz.api(value), "bar") value = "Bacon" self.assertEqual(goz.api(value), "No rules. you said: Bacon") value = "Hi" self.assertEqual(goz.api(value), "Hi, who are you?") value = "i am Alberto" self.assertEqual(goz.api(value), "Hi, alberto")
def test_value(self): gozokia = Gozokia() gozokia.set_io(input_type="value") value = "Hola hola!" self.assertEqual(gozokia.io.listen(value=value), value)
# encoding: utf-8 import sys import os from gozokia import Gozokia os.environ.setdefault("GOZOKIA_SETTINGS_MODULE", "settings") goz = Gozokia() goz.initialize() goz.set_io(input_type="terminal_txt", output_type="terminal_txt") goz.console()