Skip to content

Commit

Permalink
Add ruleset equality
Browse files Browse the repository at this point in the history
  • Loading branch information
BenBrostoff committed Jan 26, 2024
1 parent eb16209 commit f2671e4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
10 changes: 10 additions & 0 deletions draftfast/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ def __init__(
self.min_teams = min_teams
self.min_matchups = min_matchups

def __eq__(self, other):
if not other:
return False

return (
self.site == other.site
and self.league == other.league
and self.game_type == other.game_type
)


DK_NBA_RULE_SET = RuleSet(
site=DRAFT_KINGS,
Expand Down
15 changes: 15 additions & 0 deletions draftfast/test/test_ruleset_equality.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import unittest
from draftfast.rules import RuleSet


assertions = unittest.TestCase("__init__")


def test_ruleset_equality():
ruleset_a = RuleSet(
site='a', league='b', roster_size=1, position_limits=[], salary_max=1
)
ruleset_b = RuleSet(
site='a', league='b', roster_size=1, position_limits=[], salary_max=1
)
assertions.assertEqual(ruleset_a, ruleset_b)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setuptools.setup(
name='draftfast',
version='3.12.1',
version='3.12.2',
author='Ben Brostoff',
author_email='[email protected]',
description='A tool to automate and optimize DraftKings and FanDuel '
Expand Down

0 comments on commit f2671e4

Please sign in to comment.