Beispiel #1
0
 def commands(
     self, manager: ResourceManager,
     reference: functions.StringSplitFunctionResourceReference
 ) -> Iterable[Command]:
     message, indent = reference.params
     yield commands.say(message='. . ' * indent + message)
     if len(message) > 1:
         former, latter = split_in_two(message)
         yield commands.function(function=manager.name(
             functions.string_split(former, indent + 1)))
         yield commands.function(function=manager.name(
             functions.string_split(latter, indent + 1)))
Beispiel #2
0
 def test_without_any_optionals(self):
     cmd = commands.function(function='foo')
     self.assertEqual(str(cmd), 'function foo')
Beispiel #3
0
 def test_up_to_mode(self):
     cmd = commands.function(function='foo', mode='if')
     self.assertEqual(str(cmd), 'function foo if')
Beispiel #4
0
 def test_up_to_mode_target(self):
     cmd = commands.function(function='foo',
                             mode='if',
                             mode_target=selectors.SELF)
     self.assertEqual(str(cmd), 'function foo if @s')
Beispiel #5
0
 def test_default_optionals(self):
     cmd = commands.function(function='foo', mode_target=selectors.SELF)
     self.assertEqual(str(cmd), 'function foo if @s')