Esempio n. 1
0
def test_float(m):
    repack(m, -1.2)
    repack(m, 0.0)
    repack(m, 1.3)
    repack_as(m, float, -1.2)
    repack_as(m, float, 0.0)
    repack_as(m, float, 1.3)
Esempio n. 2
0
def test_string(m):
    repack(m, "")
    repack(m, "hage")
    repack(m, "コンテナ")
    repack_as(m, str, "")
    repack_as(m, str, "hage")
    repack_as(m, str, "コンテナ")
Esempio n. 3
0
def test_number(m):
    repack(m, -10)
    repack(m, 0)
    repack(m, 10)
    repack_as(m, int, -10)
    repack_as(m, int, 0)
    repack_as(m, int, 10)
Esempio n. 4
0
def test_dict(m):
    repack(m, {"a": 10})
    repack(m, {})
    repack(m, {"a": {"b": 10}})
    repack_as(m, dict, {"a": 10})
    repack_as(m, dict, {})
    repack_as(m, dict, {"a": {"b": 10}})
    repack_as(m, typing.Dict, {"a": 10})
    repack_as(m, typing.Dict[str, int], {"a": 10})
    repack_as(m, typing.Dict[str, int], {})
    repack_as(m, typing.Dict[str, typing.Dict[str, int]], {"a": {"b": 10}})
    repack_as(m, typing.Dict[str, typing.Any], {"xxx": 3.3})
Esempio n. 5
0
def test_list(m):
    repack(m, [1, 2, 3])
    repack(m, [1])
    repack(m, [])
    repack_as(m, list, [1, 2, 3])
    repack_as(m, list, [1])
    repack_as(m, list, [])
    repack_as(m, typing.List, [1, 2, 3])
    repack_as(m, typing.List[int], [1, 2, 3])
    repack_as(m, typing.List[int], [1])
    repack_as(m, typing.List[int], [])
    repack_as(m, typing.List[typing.Any], ["a", "b", "c"])
    repack_as(m, typing.List[typing.Any], ["a", "b"])
    repack_as(m, typing.List[typing.Any], ["a"])
    repack_as(m, typing.List[typing.Any], [])
Esempio n. 6
0
def test_bool(m):
    repack(m, True)
    repack(m, False)
    repack_as(m, bool, True)
    repack_as(m, bool, False)