Coverage for test\test_Star.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.6.7, created at 2024-11-18 00:10 +0000

1import re 

2 

3 

4substitutions = { 

5 "LEGAL_ISO": "USD|EUR|GBP|CAD|FPP|SC|INR|CNY", # legal ISO currency codes 

6 "LS": r"\$|\xe2\x82\xac|\u20ac|\£|\u20b9|\¥|", # legal currency symbols - Euro(cp1252, utf-8) 

7 "PLYR": r"\s?(?P<PNAME>.+?)", 

8 "CUR": r"(\$|\xe2\x82\xac|\u20ac||\£|\u20b9|\¥|)", 

9 "BRKTS": r"(\(button\) |\(small blind\) |\(big blind\) |\(button blind\) |\(button\) \(small blind\) |\(small blind\) \(button\) |\(big blind\) \(button\) |\(small blind/button\) |\(button\) \(big blind\) )?", 

10} 

11re_WinningRankOne = re.compile( 

12 r"%(PLYR)s wins the tournament and receives %(CUR)s(?P<AMT>[,\.0-9]+) - congratulations!$" % substitutions, 

13 re.MULTILINE, 

14) 

15 

16 

17def test_re_WinningRankOne(): 

18 text = """jeje_sat wins the tournament and receives €0.75 - congratulations!""" 

19 match = re_WinningRankOne.search(text) 

20 assert match is not None 

21 assert match.group("PNAME") == "jeje_sat" 

22 assert match.group("AMT") == "0.75"