Пример #1
0
def test_unitsum_tuples2():
    s = np.asarray(list(unitsum_tuples(4, 3, -1, 3)))
    s_ = np.asarray([
        (-1.0, -1.0, 3.0),
        (-1.0, 0.0, 2.0),
        (-1.0, 1.0, 1.0),
        (-1.0, 2.0, 0.0),
        (-1.0, 3.0, -1.0),
        (0.0, -1.0, 2.0),
        (0.0, 0.0, 1.0),
        (0.0, 1.0, 0.0),
        (0.0, 2.0, -1.0),
        (1.0, -1.0, 1.0),
        (1.0, 0.0, 0.0),
        (1.0, 1.0, -1.0),
        (2.0, -1.0, 0.0),
        (2.0, 0.0, -1.0),
        (3.0, -1.0, -1.0),
    ])
    assert np.allclose(s, s_)
Пример #2
0
def test_unitsum_tuples2():
    s = np.asarray(list(unitsum_tuples(4, 3, -1, 3)))
    s_ = np.asarray([
        (-1.0, -1.0, 3.0),
        (-1.0, 0.0, 2.0),
        (-1.0, 1.0, 1.0),
        (-1.0, 2.0, 0.0),
        (-1.0, 3.0, -1.0),
        (0.0, -1.0, 2.0),
        (0.0, 0.0, 1.0),
        (0.0, 1.0, 0.0),
        (0.0, 2.0, -1.0),
        (1.0, -1.0, 1.0),
        (1.0, 0.0, 0.0),
        (1.0, 1.0, -1.0),
        (2.0, -1.0, 0.0),
        (2.0, 0.0, -1.0),
        (3.0, -1.0, -1.0),
    ])
    assert np.allclose(s, s_)
Пример #3
0
def test_unitsum_tuples3():
    # Violate: 1 = mx + (k-1) * mn
    g = unitsum_tuples(3, 3, 1, 0)
    with pytest.raises(Exception):
        next(g)
Пример #4
0
def test_unitsum_tuples1():
    s = np.asarray(list(unitsum_tuples(3, 2, .2, .8)))
    s_ = np.asarray([[.2, .8], [.4, .6], [.6, .4], [.8, .2]])
    assert np.allclose(s, s_)
Пример #5
0
def test_unitsum_tuples3():
     # Violate: 1 = mx + (k-1) * mn
     g = unitsum_tuples(3, 3, 1, 0)
     with pytest.raises(Exception):
         next(g)
Пример #6
0
def test_unitsum_tuples1():
    s = np.asarray(list(unitsum_tuples(3, 2, .2, .8)))
    s_ = np.asarray([[.2, .8], [.4, .6], [.6, .4], [.8, .2]])
    assert np.allclose(s, s_)
Пример #7
0
def test_unitsum_tuples3():
    # Violate: 1 = mx + (k-1) * mn
    g = unitsum_tuples(3, 3, 1, 0)
    assert_raises(Exception, next, g)
Пример #8
0
def test_unitsum_tuples3():
     # Violate: 1 = mx + (k-1) * mn
     g = unitsum_tuples(3, 3, 1, 0)
     assert_raises(Exception, next, g)