Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example in test for stamped initialization issue from #347 #350

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

yuwash
Copy link
Contributor

@yuwash yuwash commented Nov 28, 2023

The pull request #347 didn’t contain a test that showed the difference, so here it is. Without the fix, the test would’ve failed like:

for ical in non_broken_ical:                                            
>               assert vcal.fix(ical) == ical

tests/test_vcal.py:262:                                                             
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
caldav/lib/vcal.py:81: in fix             
    "\n".join(filter(LineFilterDiscardingDuplicates(), fixed.strip().split("\n")))  
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
                                          
self = <caldav.lib.vcal.LineFilterDiscardingDuplicates object at 0x7a99fd022820>    
line = 'DTSTAMP:20210205T101751Z'                                                   
                                                                                    
    def __call__(self, line):                                                       
        if line.startswith("BEGIN:V"):                                              
            self.stamped = 0                                                                                                                                            
            self.ended = 0                                                          
                                                                                    
        elif re.match("(DURATION|DTEND|DUE)[:;]", line):
            if self.ended:
                return False
            self.ended += 1
                                          
        elif re.match("DTSTAMP[:;]", line):
>           if self.stamped:
E           AttributeError: 'LineFilterDiscardingDuplicates' object has no attribute 'stamped'

caldav/lib/vcal.py:141: AttributeError

@yuwash yuwash force-pushed the initialize-stamped branch from 0c00f16 to 584de64 Compare November 28, 2023 18:44
@tobixen
Copy link
Member

tobixen commented Nov 28, 2023

Perfect. This closes #349

@tobixen tobixen added this pull request to the merge queue Nov 28, 2023
Merged via the queue into python-caldav:master with commit fcef569 Nov 28, 2023
7 checks passed
@tobixen
Copy link
Member

tobixen commented Nov 28, 2023

While it also would be nice with some unit test exercising the new class specifically, I believe it should already be more or less covered by existing tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants