Browse Source

more message testing

feature/find_holes
Figg 9 months ago
parent
commit
0741257e96
2 changed files with 11 additions and 1 deletions
  1. 1
    1
      million/analyze/message_evaluation.py
  2. 10
    0
      test/model/message_test.py

+ 1
- 1
million/analyze/message_evaluation.py View File

44
     if not msg.content:
44
     if not msg.content:
45
         return
45
         return
46
     
46
     
47
-    s = re.sub(r"[^\s\d]","", msg.content)
47
+    s = re.sub(r'[^\s\d.,]|[.,]{2,}',"", msg.content)
48
     match = re.search(r"\d+", s)
48
     match = re.search(r"\d+", s)
49
 
49
 
50
     if match:
50
     if match:

+ 10
- 0
test/model/message_test.py View File

9
 
9
 
10
         assert 1 == msg_val.get(message)
10
         assert 1 == msg_val.get(message)
11
 
11
 
12
+    def test_nothing(self, overrides=None, exclude=None):
13
+        message = self._message_with_text("")
14
+
15
+        assert None == msg_val.get(message)
16
+
12
     def test_message_nominal(self, overrides=None, exclude=None):
17
     def test_message_nominal(self, overrides=None, exclude=None):
13
         message = self._message_with_text("1234")
18
         message = self._message_with_text("1234")
14
 
19
 
48
         message = self._message_with_text("A peine 5565 ouais...")
53
         message = self._message_with_text("A peine 5565 ouais...")
49
 
54
 
50
         assert 5565 == msg_val.get(message)
55
         assert 5565 == msg_val.get(message)
56
+
57
+    def test_message_float_1(self, overrides=None, exclude=None):
58
+        message = self._message_with_text("11111,1111111111111111¼")
59
+
60
+        assert 11111 == msg_val.get(message)

Loading…
Cancel
Save