コード例 #1
0
def test_access_operators_NOD_of():
    list_rep = NOD("str_parameter", 10).as_list()
    arg0 = list_rep[0]
    arg1 = list_rep[1]
    columns = NOD.nod_of(arg1, dsa=arg0)
    assert columns["arg1"] == arg1
    assert columns.arg1 == arg1
    assert columns["dsa"] == arg0
    assert columns / "dsa" == arg0
    assert columns @ "dsa" == arg0
    assert id(columns / "dsa") == id(columns["dsa"])
コード例 #2
0
ファイル: test_nod.py プロジェクト: pything/warg
def test_nested():
    cfg = NOD()

    cfg.MODEL = NOD()

    cfg.MODEL.DEVICE = "cuda"
    # match default boxes to any ground truth with jaccard overlap higher than a threshold (0.5)
    cfg.MODEL.THRESHOLD = 0.5
    cfg.MODEL.NUM_CLASSES = 21
    # Hard negative mining
    cfg.MODEL.NEG_POS_RATIO = 3
    cfg.MODEL.CENTER_VARIANCE = 0.1
    cfg.MODEL.SIZE_VARIANCE = 0.2

    cfg.ADSA = 203182

    print(cfg)
コード例 #3
0
def test_access_operators_no_multi_return_no_variable_name_direct_inference():
    arg0 = "str_parameter"
    columns = NOD.nod_of("sas", dsa=arg0)
    print(columns)
    assert columns[:1] == ["sas"]
    assert columns.as_list()[0] == "sas"
    assert columns.as_list()[1] == arg0
    assert columns["dsa"] == arg0
    assert columns / "dsa" == arg0
    assert id(columns / "dsa") == id(columns["dsa"])
コード例 #4
0
ファイル: test_nod.py プロジェクト: pything/warg
def test_update_and_set_attr_update():
    nodict = NOD()
    nodict.update({"paramA": 20, "paramB": "other_param", "paramC": 5.0})
    nodict.paramA = 10
    assert nodict.paramA == 10
    assert nodict.paramB == "other_param"
コード例 #5
0
ファイル: test_nod.py プロジェクト: pything/warg
def test_dict_arg_construction():
    nodict = NOD({"paramA": "str_parameter", "paramB": 10})
    assert nodict.paramA == "str_parameter"
    assert nodict.paramB == 10
コード例 #6
0
ファイル: test_nod.py プロジェクト: pything/warg
def test_slice_all():
    a = NOD(4, 2)
    b = a + a + a
    b[:1] = [8]
    assert b.as_list() == [8, 6]
コード例 #7
0
ファイル: test_nod.py プロジェクト: pything/warg
def test_slice_set():
    a = NOD(4, 2)
    a[:1] = [8]
    assert a.as_list() == [8, 2]
コード例 #8
0
ファイル: test_nod.py プロジェクト: pything/warg
def test_slice_get_adv():
    a = NOD(4, 2)
    b = a[:1] + a[0:]
    assert b[:1] == [4]
    assert b[-1:] == [2]
コード例 #9
0
ファイル: test_nod.py プロジェクト: pything/warg
def test_slice_get():
    a = NOD(4, 2)
    b = a + a
    assert b[:1] == [8]
    assert b[-1:] == [4]
コード例 #10
0
ファイル: test_nod.py プロジェクト: pything/warg
def test_illegal_overwrite():
    with pytest.raises(IllegalAttributeKey) as exc_info:
        NOD(update=2)

    assert exc_info.type is IllegalAttributeKey
コード例 #11
0
ファイル: test_nod.py プロジェクト: pything/warg
def test_addition_arithmetic():
    a = NOD(4, 2)
    b = a + a
    assert b.as_list() == [8, 4]
コード例 #12
0
ファイル: test_nod.py プロジェクト: pything/warg
def test_new_attr_on_existing():
    a = NOD(4, 2)
    a.list = "a"
    assert a.list == "a"