Bläddra i källkod

more message testing

feature/find_holes
Figg 9 månader sedan
förälder
incheckning
0741257e96
2 ändrade filer med 11 tillägg och 1 borttagningar
  1. 1
    1
      million/analyze/message_evaluation.py
  2. 10
    0
      test/model/message_test.py

+ 1
- 1
million/analyze/message_evaluation.py Visa fil

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

+ 10
- 0
test/model/message_test.py Visa fil

@@ -9,6 +9,11 @@ class MessageTest(TestCase):
9 9
 
10 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 17
     def test_message_nominal(self, overrides=None, exclude=None):
13 18
         message = self._message_with_text("1234")
14 19
 
@@ -48,3 +53,8 @@ class MessageTest(TestCase):
48 53
         message = self._message_with_text("A peine 5565 ouais...")
49 54
 
50 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)

Laddar…
Avbryt
Spara