Skip to content

Commit

Permalink
fix: subtitle inequality to None
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Kozyrenko authored and cdown committed Nov 2, 2023
1 parent 434d0c1 commit df8de24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion srt.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def __hash__(self):
return hash(frozenset(vars(self).items()))

def __eq__(self, other):
return vars(self) == vars(other)
return other and vars(self) == vars(other)

def __lt__(self, other):
return (self.start, self.end, self.index) < (
Expand Down
5 changes: 5 additions & 0 deletions tests/test_srt.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ def test_subtitle_inequality(sub_1):
assert sub_1 != sub_2


@given(subtitles())
def test_subtitle_inequality_to_none(sub_1):
assert sub_1 != None


@given(subtitles())
def test_subtitle_from_scratch_equality(subtitle):
srt_block = subtitle.to_srt()
Expand Down

0 comments on commit df8de24

Please sign in to comment.