def test_flags(capsys, hf):
    contributors = list()
    contributors.append(br.Contributor("Bud", "Suite", "D", commits=10, github="buddysuite"))
    contributors.append(br.Contributor("Sweet", "Water", commits=5, github="sweetwater"))
    version = br.Version("BudddySuite", "3", "5", contributors, release_date={"day": 13, "month": 7, "year": 2016})

    parser = argparse.ArgumentParser(prog="SeqBuddy.py", add_help=False)
    pos_dict = ("sequence", "Supply file path(s) or raw sequence. If piping sequences "
                            "into SeqBuddy this argument can be left blank.")
    flag_dict = {"annotate": {"flag": "ano",
                              "nargs": "*",
                              "metavar": "args",
                              "help": "Add a feature (annotation) to selected sequences. "
                                      "Args: <name>, <location (start1-end1,start2-end2...)>, [strand (+|-)], "
                                      "[qualifier (foo=bar) [qualifier]], [regex_pattern [regex_[pattern]]}"},
                 "ave_seq_length": {"flag": "asl",
                                    "action": "append",
                                    "nargs": "?",
                                    "metavar": "'clean'",
                                    "help": "Calculate average sequence length. Specify 'clean' to remove gaps etc "
                                            "first"}}
    mod_dict = {"alpha": {"flag": "a",
                          "action": "store",
                          "help": "If you want the file read with a specific alphabet"},
                "in_format": {"flag": "f",
                              "action": "store",
                              "help": "If SeqBuddy can't guess the file format, try specifying it directly"}}

    br.flags(parser, _positional=pos_dict, _flags=flag_dict, _modifiers=mod_dict, version=version)
    parser.print_help()
    out, err = capsys.readouterr()
    assert hf.string2hash(out) == "9ea2d4ac842b1712687034ea0abf497b"
def test_contributor():
    contributor = br.Contributor("Bud", "Suite", "D", commits=10, github="buddysuite")
    assert contributor.name() == "Bud D Suite"
    assert str(contributor) == "Bud Suite, buddysuite"

    contributor = br.Contributor("Bud", "Suite")
    assert contributor.name() == "Bud Suite"
    assert str(contributor) == "Bud Suite"
def test_version():
    contributors = list()
    contributors.append(br.Contributor("Bud", "Suite", "D", commits=10, github="buddysuite"))
    contributors.append(br.Contributor("Sweet", "Water", commits=5, github="sweetwater"))
    version = br.Version("BudddySuite", "3", "5", contributors, release_date={"day": 13, "month": 7, "year": 2016})
    assert version.short() == "3.5"
    assert version.contributors_string() == "Bud D Suite  buddysuite\nSweet Water  sweetwater"
    version_string = re.sub("[\n| ]", "", str(version))
    assert version_string == "BudddySuite3.5(2016-07-13)PublicDomainNoticeThisisfreesoftware;seethesourcefordetailed" \
                             "copyingconditions.ThereisNOwarranty;notevenforMERCHANTABILITYorFITNESSFORAPARTICULAR" \
                             "PURPOSE.Questions/comments/concernscanbedirectedtoSteveBond,[email protected]" \
                             "Contributors:BudDSuitebuddysuiteSweetWatersweetwater"