예제 #1
0
def test_nested():
    assert (
        nlsd.to_string([{
            "a": 1
        }, {
            "b": 2
        }]) ==
        "the list henceforth `the list` where an item is the object where `a` is 1 and another item of `the list` is the object where `b` is 2"
    )
    assert (
        nlsd.to_string({
            "a": [1],
            "b": [2]
        }) ==
        "the object henceforth `the object` where `a` is the list where an item is 1 and `b` of `the object` is the list where an item is 2"
    )
예제 #2
0
def test_nested():
    assert (nlsd.from_string(nlsd.to_string([{
        "a": 1
    }, {
        "b": 2
    }])) == [{
        "a": 1
    }, {
        "b": 2
    }])
    assert (nlsd.from_string(nlsd.to_string({
        "a": [1],
        "b": [2]
    })) == {
        "a": [1],
        "b": [2]
    })
예제 #3
0
def test_object():
    assert (nlsd.from_string(nlsd.to_string({
        "a": 1,
        "b": 2
    })) == {
        "a": 1,
        "b": 2
    })
예제 #4
0
def test_bool():
    assert (nlsd.from_string(nlsd.to_string(True)) == True)
    assert (nlsd.from_string(nlsd.to_string(False)) == False)
예제 #5
0
def test_none():
    assert (nlsd.from_string(nlsd.to_string(None)) == None)
예제 #6
0
def test_list():
    assert (nlsd.from_string(nlsd.to_string([1, 2, 3])) == [1, 2, 3])
예제 #7
0
def test_num():
    assert (nlsd.from_string(nlsd.to_string(1)) == 1)
    assert (nlsd.from_string(nlsd.to_string(1.2)) == 1.2)
    assert (nlsd.from_string(nlsd.to_string(-123)) == -123)
예제 #8
0
def test_string():
    assert (nlsd.from_string(nlsd.to_string("hello")) == "hello")
예제 #9
0
def test_bool():
    assert (nlsd.to_string(True) == "true")
    assert (nlsd.to_string(False) == "false")
예제 #10
0
def test_none():
    assert (nlsd.to_string(None) == "empty")
예제 #11
0
def test_object():
    assert (nlsd.to_string({
        "a": 1,
        "b": 2
    }) == "the object where `a` is 1 and `b` is 2")
예제 #12
0
def test_list():
    assert (
        nlsd.to_string([1, 2, 3]) ==
        "the list where an item is 1 and another item is 2 and another item is 3"
    )
예제 #13
0
def test_num():
    assert (nlsd.to_string(1) == "1")
    assert (nlsd.to_string(1.2) == "1.2")
    assert (nlsd.to_string(-123) == "-123")
예제 #14
0
def test_string():
    assert (nlsd.to_string("hello") == "`hello`")