How to use the domdiv.main.parse_opts function in domdiv

To help you get started, we’ve selected a few domdiv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sumpfork / dominiontabs / tests / layout_tests.py View on Github external
def test_set_icon():
    options = main.parse_opts([])
    options = main.clean_opts(options)
    assert options.set_icon == ["tab"]

    options = main.parse_opts(["--set-icon=tab"])
    options = main.clean_opts(options)
    assert options.set_icon == ["tab"]

    options = main.parse_opts(["--set-icon=body-top"])
    options = main.clean_opts(options)
    assert options.set_icon == ["body-top"]

    options = main.parse_opts(["--set-icon=hide"])
    options = main.clean_opts(options)
    assert options.set_icon == ["hide"]

    options = main.parse_opts(["--set-icon=tab", "--set-icon=body-top"])
    options = main.clean_opts(options)
    assert set(options.set_icon) == {"tab", "body-top"}
github sumpfork / dominiontabs / tests / carddb_tests.py View on Github external
def test_only_type():
    options = main.parse_opts(
        [
            "--expansions",
            "base",
            "alchemy",
            "--include-blanks",
            "5",
            "--only-type-any",
            "blank",
            "curse",
            "--only-type-all",
            "attack",
            "action",
        ]
    )
    options = main.clean_opts(options)
    options.data_path = "."
github sumpfork / dominiontabs / tests / carddb_tests.py View on Github external
u"empires",
        u"empires extras",
        u"nocturne",
        u"nocturne extras",
        u"promo",
        u"renaissance",
        u"menagerie",
        u"extras",
        u"animals",
    }
    for c in cards:
        assert isinstance(c, domdiv_cards.Card)
        assert c.cardset_tag in valid_cardsets

    # Option modified card count
    options = main.parse_opts(
        ["--no-trash", "--curse10", "--start-decks", "--include-blanks", "7"]
    )
    options = main.clean_opts(options)
    options.data_path = "."
    cards = main.read_card_data(options)
    # Total delta cards is +28 from
    #      Trash:       -1 * 3 sets = -3
    #      Curse:       +2 * 4 sets = +8
    #      Start Decks: +4 * 4 sets = +16
    #      Blanks:      +7          = +7
    assert len(cards) == num_cards_expected + 28
github sumpfork / dominiontabs / tests / carddb_tests.py View on Github external
def test_exclude_expansion():
    # test that we can use --exclude-expansion or
    # --exclude-expansions, that we can have multiple
    # items with a single flag, that * syntax
    # works, that we can use either the
    # cardset tag or name, and that capitalization
    # doesn't matter
    options = main.parse_opts(
        [
            "--expansions",
            "adventures",
            "dominion*",
            "intrigue*",
            "--exclude-expansions",
            "dominiOn1stEditIon",
            "intrigue 2nd*",
            "--exclude-expansion",
            "dominion 2nd edition",
        ]
    )
    options = main.clean_opts(options)
    options.data_path = "."
    cards = main.read_card_data(options)
    cards = main.filter_sort_cards(cards, options)
github sumpfork / dominiontabs / tests / layout_tests.py View on Github external
def test_cost():
    options = main.parse_opts([])
    options = main.clean_opts(options)
    assert options.cost == ["tab"]

    options = main.parse_opts(["--cost=tab"])
    options = main.clean_opts(options)
    assert options.cost == ["tab"]

    options = main.parse_opts(["--cost=body-top"])
    options = main.clean_opts(options)
    assert options.cost == ["body-top"]

    options = main.parse_opts(["--cost=hide"])
    options = main.clean_opts(options)
    assert options.cost == ["hide"]

    options = main.parse_opts(["--cost=tab", "--cost=body-top"])
    options = main.clean_opts(options)
    assert set(options.cost) == {"tab", "body-top"}
github sumpfork / dominiontabs / tests / layout_tests.py View on Github external
def test_vertical():
    options = main.parse_opts(["--orientation", "vertical"])
    assert options.orientation == "vertical"
    main.calculate_layout(options)
    assert options.numDividersHorizontal == 3
    assert options.numDividersVertical == 2
    assert options.dividerWidth == 5.9 * cm
    assert options.labelHeight == 0.9 * cm
    assert options.dividerHeight == 9.1 * cm + options.labelHeight