Coverage for test\test_Star.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-28 16:41 +0000

1import re 

2import pytest 

3 

4 

5substitutions = { 

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

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

8 'PLYR': r'\s?(?P<PNAME>.+?)', 

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

10 'BRKTS': r'(\(button\) |\(small blind\) |\(big blind\) |\(button blind\) |\(button\) \(small blind\) |\(small blind\) \(button\) |\(big blind\) \(button\) |\(small blind/button\) |\(button\) \(big blind\) )?', 

11 } 

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

13 

14def test_re_WinningRankOne(): 

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

16 match = re_WinningRankOne.search(text) 

17 assert match is not None 

18 assert match.group('PNAME') == "jeje_sat" 

19 assert match.group('AMT') == "0.75"