Beispiel #1
0
def test_weighted_5():
    data = bson.Decimal128("5.5")
    assert Weighted(data) == (2, _cmp_decimal(data))
Beispiel #2
0
def test_weighted_6():
    data = "string"
    assert Weighted(data) == (3, data)
Beispiel #3
0
def test_weighted_15():
    data = True
    assert Weighted(data) == (8, data)
Beispiel #4
0
def test_weighted_1():
    data = None
    assert Weighted(data) == (1, data)
Beispiel #5
0
def test_weighted_11():
    data = {"a": [1, 2, 3]}
    assert Weighted(data) == (4, ((5, "a", ((2, 1), (2, 2), (2, 3))),))
Beispiel #6
0
def test_weighted_13():
    data = (8, 9)
    assert Weighted(data) == (5, ((2, 8), (2, 9)))
Beispiel #7
0
def test_weighted_24():
    data = bson.MaxKey()
    assert Weighted(data) == (127, data)
Beispiel #8
0
def test_weighted_9():
    data = {"a": None}
    assert Weighted(data) == (4, ((1, "a", None),))
Beispiel #9
0
def test_weighted_22():
    data = bson.Code("a", {})
    assert Weighted(data) == (13, "a", ())
Beispiel #10
0
def test_weighted_23():
    data = bson.MinKey()
    assert Weighted(data) == (-1, data)
Beispiel #11
0
def test_weighted_21():
    data = bson.Code("a")
    assert Weighted(data) == (12, "a", None)
Beispiel #12
0
def test_weighted_20():
    data = re.compile("^a", re.X | re.M)
    flag = "mux" if PY3 else "mx"
    assert Weighted(data) == (11, "^a", flag)
Beispiel #13
0
def test_weighted_19():
    data = bson.Regex("^a", "ix")
    assert Weighted(data) == (11, "^a", "ix")
Beispiel #14
0
def test_weighted_7():
    data = bson.Binary(b"001")
    assert Weighted(data) == (6, data)
Beispiel #15
0
def test_weighted_25():
    class UnKnownObj:
        pass
    data = UnKnownObj()
    with pytest.raises(TypeError):
        Weighted(data)
Beispiel #16
0
def test_weighted_8():
    data = b"001"
    if PY3:
        assert Weighted(data) == (6, data)
    else:
        assert Weighted(data) == (3, data)
Beispiel #17
0
def test_weighted_26():
    data = _cmp_decimal(bson.Decimal128("0.1"))
    assert Weighted(data) == (2, data)
Beispiel #18
0
def test_weighted_10():
    data = {"a": "doc", "b": 5}
    assert Weighted(data)[0] == 4
    assert (3, "a", "doc") in Weighted(data)[1]
    assert (2, "b", 5) in Weighted(data)[1]
Beispiel #19
0
def test_weighted_2():
    data = 6
    assert Weighted(data) == (2, data)
Beispiel #20
0
def test_weighted_12():
    data = [8, 9]
    assert Weighted(data) == (5, ((2, 8), (2, 9)))
Beispiel #21
0
def test_weighted_3():
    data = 1.1
    assert Weighted(data) == (2, data)
Beispiel #22
0
def test_weighted_14():
    data = bson.ObjectId(b"000000000001")
    assert Weighted(data) == (7, data)
Beispiel #23
0
def test_weighted_4():
    data = bson.Int64(8)
    assert Weighted(data) == (2, data)
Beispiel #24
0
def test_weighted_16():
    data = datetime(2018, 5, 13)
    assert Weighted(data) == (9, data)
Beispiel #25
0
def test_weighted_17():
    data = bson.Timestamp(0, 1)
    assert Weighted(data) == (10, data)