Skip to content

Commit df3c30a

Browse files
committed
HH-137697 fix errors
1 parent b5ad547 commit df3c30a

4 files changed

Lines changed: 12 additions & 10 deletions

File tree

rivescript/brain.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def reply_regexp(self, user, regexp):
449449
if regexp[-2:] == ' *':
450450
regexp = regexp.replace(regexp[-2:], '( *|)')
451451
if regexp[:2] == '* ':
452-
regexp = regexp.replace(regexp[:2], '(| *)')
452+
regexp = regexp.replace(regexp[:2], '(|* )')
453453
if '*' in regexp:
454454
for i in range(len(regexp)):
455455
if regexp[i] == '*':
@@ -579,6 +579,7 @@ def process_tags(self, user, msg, reply, st=[], bst=[], depth=0, ignore_object_e
579579
"""
580580
stars = ['']
581581
stars.extend(st)
582+
stars = [star.strip() if star else star for star in stars]
582583
botstars = ['']
583584
botstars.extend(bst)
584585
if len(stars) == 1:

tests/test_botvars.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_global_variables(self):
4949
- Debug mode is: <env debug>
5050
5151
+ set debug mode *
52-
- <env debug=<person>>Switched to <person>.
52+
- <env debug=<star>>Switched to <star>.
5353
5454
+ are you testing
5555
- Testing: <env testing>

tests/test_replies.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ def test_embedded_tags(self):
113113
- <set name=<b>Name</b>>This has some non-RS <em>tags</em> in it.
114114
115115
+ i am from rus*
116-
- You are from Russia?
116+
- Are you from Russia?
117117
118118
+ i am from *lia
119-
* <star> == brasi => You are from Brasilia?
120-
- You are from big city?
119+
* <star> == brasi => Are you from Brasilia?
120+
- Are you from big city?
121121
122122
+ hello my * *friend
123-
- I love you, my <person>!
123+
- I love you, my <star>!
124124
125125
+ *
126126
- Random reply
@@ -130,12 +130,12 @@ def test_embedded_tags(self):
130130
self.reply("My name is Bob.", "I thought your name was Alice?")
131131
self.reply("What is my name?", "Your name is Bob, right?")
132132
self.reply("HTML Test", "This has some non-RS <em>tags</em> in it.")
133-
self.reply("I am from Russia", "You are from Russia?")
134-
self.reply("I am from RussiaFederation", "You are from Russia?")
133+
self.reply("I am from Russia", "Are you from Russia?")
134+
self.reply("I am from RussiaFederation", "Are you from Russia?")
135135
self.reply("I am from Russia Federation", "Random reply")
136136
self.reply("Hello my best friend", "I love you, my best!")
137137
self.reply("Hello my best best friend", "I love you, my best best!")
138138
self.reply("Hello my best little bestfriend", "I love you, my best little!")
139139
self.reply("Hello my friend", "I love you, my !")
140-
self.reply("I am from Brasilia", "You are from Brasilia?")
141-
self.reply("I am from Sicilia", "You are from big city?")
140+
self.reply("I am from Brasilia", "Are you from Brasilia?")
141+
self.reply("I am from Sicilia", "Are you from big city?")

tests/test_unicode.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def test_unicode(self):
3535
- <sentence> who?
3636
3737
+ *
38+
% * who
3839
- Haha! <sentence>!
3940
4041
// And with UTF-8.

0 commit comments

Comments
 (0)