예제 #1
0
 def create_the_long_way(self, *inputs):
     """
     "Helper method that returns a Template with the given inputs.
     """
     t = Template()
     for i in inputs:
         t.learn(i)
     return t
예제 #2
0
 def create_the_long_way(self, *inputs):
     """
     "Helper method that returns a Template with the given inputs.
     """
     t = Template()
     for i in inputs:
         t.learn(i)
     return t
예제 #3
0
 def test_none(self):
     t = Template(brain=None)
     self.assertEqual(t.brain, None)
예제 #4
0
 def test_brain(self):
     t = Template(brain=[Hole(), 'abc', Hole()])
     self.assertEqual(t.brain, [Hole(), 'abc', Hole()])
예제 #5
0
 def test_string(self):
     # If this fails due to eg. module renaming, you can recreate
     # correct output like: Brain([Hole(), 'abc', Hole()]).serialize()
     serialized = 'gAJjZWJkYXRhLnRlbXBsYXRlbWFrZXIuYnJhaW4KQnJhaW4KcQEpgXECKGNlYmRhdGEudGVtcGxh\ndGVtYWtlci5ob2xlCkhvbGUKcQMpgXEEfXEFYlUDYWJjcQZoAymBcQd9cQhiZX1xCWIu\n'
     t = Template(serialized)
     self.assertEqual(t.brain, [Hole(), 'abc', Hole()])
예제 #6
0
 def create_the_short_way(self, *inputs):
     t = Template()
     t.learn(*inputs)
     return t
예제 #7
0
 def setUp(self):
     self.template = Template(Brain(['foo and ', Hole()]))
예제 #8
0
 def setUp(self):
     self.template = Template(Brain([Hole(), ' and bar']))
예제 #9
0
 def setUp(self):
     self.template = Template(
         Brain(['<p>', Hole(), ' and ',
                Hole(), '</p>']))
예제 #10
0
 def setUp(self):
     self.template = Template(Brain(['Hello, ', Hole(), '. How are you?']))
예제 #11
0
 def setUp(self):
     self.template = Template(Brain(['hello']))
예제 #12
0
 def test_string(self):
     t = Template(
         brain=
         'Y2NvcHlfcmVnCl9yZWNvbnN0cnVjdG9yCnAxCihjZXZlcnlibG9jay50ZW1wbGF0ZW1ha2VyLmJy\nYWluCkJyYWluCnAyCmNfX2J1aWx0aW5fXwpsaXN0CnAzCihscDQKZzEKKGNldmVyeWJsb2NrLnRl\nbXBsYXRlbWFrZXIuaG9sZQpIb2xlCnA1CmNfX2J1aWx0aW5fXwpvYmplY3QKcDYKTnRScDcKYVMn\nYWJjJwpwOAphZzEKKGc1Cmc2Ck50UnA5CmF0UnAxMAou\n'
     )
     self.assertEqual(t.brain, [Hole(), 'abc', Hole()])
예제 #13
0
 def create_the_short_way(self, *inputs):
     t = Template()
     t.learn(*inputs)
     return t