Example #1
0
 def test_match_pattern(self):
     self.assertEqual(
         {'y': ['bob'], 'x': ['john', 'jay']},
         eliza.match_pattern(
             'hello ?y my name is ?*x pleased to meet you'.split(),
             'hello bob my name is john jay pleased to meet you'.split(),
             {}))
Example #2
0
 def test_match_pattern(self):
     self.assertEqual(
         {
             'y': ['bob'],
             'x': ['john', 'jay']
         },
         eliza.match_pattern(
             'hello ?y my name is ?*x pleased to meet you'.split(),
             'hello bob my name is john jay pleased to meet you'.split(),
             {}))
Example #3
0
 def test_match_var(self):
     self.assertEqual({'x': ['bob']}, eliza.match_pattern('?x', 'bob', {}))
Example #4
0
 def test_match_segment(self):
     self.assertEqual({'x': ['hello', 'bob']},
                      eliza.match_pattern(['?*x', 'world'],
                                          ['hello', 'bob', 'world'], {}))
Example #5
0
 def test_match_no_more_vars_fail(self):
     self.assertFalse(eliza.match_pattern(['hello', 'world'],
                                          ['hello', 'bob'], {}))
Example #6
0
 def test_no_more_vars(self):
     self.assertEqual({}, eliza.match_pattern(['hello', 'world'],
                                              ['hello', 'world'], {}))
Example #7
0
 def test_empty_pattern(self):
     self.assertFalse(eliza.match_pattern([], ['foo', 'bar'], {}))
Example #8
0
 def test_empty_input(self):
     self.assertFalse(eliza.match_pattern(['foo', '?x'], [], {}))
Example #9
0
 def test_match_segment(self):
     self.assertEqual({'x': ['hello', 'bob']},
                      eliza.match_pattern(['?*x', 'world'],
                                          ['hello', 'bob', 'world'], {}))
Example #10
0
 def test_match_no_more_vars_fail(self):
     self.assertFalse(
         eliza.match_pattern(['hello', 'world'], ['hello', 'bob'], {}))
Example #11
0
 def test_no_more_vars(self):
     self.assertEqual({},
                      eliza.match_pattern(['hello', 'world'],
                                          ['hello', 'world'], {}))
Example #12
0
 def test_empty_pattern(self):
     self.assertFalse(eliza.match_pattern([], ['foo', 'bar'], {}))
Example #13
0
 def test_empty_input(self):
     self.assertFalse(eliza.match_pattern(['foo', '?x'], [], {}))
Example #14
0
 def test_match_var(self):
     self.assertEqual({'x': ['bob']}, eliza.match_pattern('?x', 'bob', {}))