예제 #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(),
             {}))
예제 #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(),
             {}))
예제 #3
0
 def test_match_var(self):
     self.assertEqual({'x': ['bob']}, eliza.match_pattern('?x', 'bob', {}))
예제 #4
0
 def test_match_segment(self):
     self.assertEqual({'x': ['hello', 'bob']},
                      eliza.match_pattern(['?*x', 'world'],
                                          ['hello', 'bob', 'world'], {}))
예제 #5
0
 def test_match_no_more_vars_fail(self):
     self.assertFalse(eliza.match_pattern(['hello', 'world'],
                                          ['hello', 'bob'], {}))
예제 #6
0
 def test_no_more_vars(self):
     self.assertEqual({}, eliza.match_pattern(['hello', 'world'],
                                              ['hello', 'world'], {}))
예제 #7
0
 def test_empty_pattern(self):
     self.assertFalse(eliza.match_pattern([], ['foo', 'bar'], {}))
예제 #8
0
 def test_empty_input(self):
     self.assertFalse(eliza.match_pattern(['foo', '?x'], [], {}))
예제 #9
0
 def test_match_segment(self):
     self.assertEqual({'x': ['hello', 'bob']},
                      eliza.match_pattern(['?*x', 'world'],
                                          ['hello', 'bob', 'world'], {}))
예제 #10
0
 def test_match_no_more_vars_fail(self):
     self.assertFalse(
         eliza.match_pattern(['hello', 'world'], ['hello', 'bob'], {}))
예제 #11
0
 def test_no_more_vars(self):
     self.assertEqual({},
                      eliza.match_pattern(['hello', 'world'],
                                          ['hello', 'world'], {}))
예제 #12
0
 def test_empty_pattern(self):
     self.assertFalse(eliza.match_pattern([], ['foo', 'bar'], {}))
예제 #13
0
 def test_empty_input(self):
     self.assertFalse(eliza.match_pattern(['foo', '?x'], [], {}))
예제 #14
0
 def test_match_var(self):
     self.assertEqual({'x': ['bob']}, eliza.match_pattern('?x', 'bob', {}))