예제 #1
0
def test_stringify_keys_for_instance():
    class MyClass:
        ...

    instance = MyClass()
    actual = stringify_keys({instance: 1})
    assert isinstance(list(actual.keys())[0], str)
    assert list(actual.values()) == [1]
예제 #2
0
def test_stringify_keys_for_nested():
    actual = stringify_keys({(1, 2): {1: 1, 2: 2}, 3: 3})
    assert actual == {"(1, 2)": {"1": 1, "2": 2}, "3": 3}
예제 #3
0
def test_stringify_keys_for_bytes():
    actual = stringify_keys({b"\x00\x10": 1})
    assert actual == {"b'\\x00\\x10'": 1}
예제 #4
0
def test_stringify_keys_for_range():
    actual = stringify_keys({range(3): 3})
    assert actual == {"range(0, 3)": 3}
예제 #5
0
def test_stringify_keys_for_frozenset():
    actual = stringify_keys({frozenset([1, 2]): 3})
    assert actual == {"frozenset({1, 2})": 3}
예제 #6
0
def test_stringify_keys_for_tuple():
    actual = stringify_keys({(1, 2): 3})
    assert actual == {"(1, 2)": 3}
예제 #7
0
def test_stringify_keys_for_bool():
    actual = stringify_keys({True: 1})
    assert actual == {"True": 1}
예제 #8
0
def test_stringify_keys_for_float():
    actual = stringify_keys({1.0: 2})
    assert actual == {"1.0": 2}
예제 #9
0
def test_stringify_keys_for_int():
    actual = stringify_keys({1: 2})
    assert actual == {"1": 2}
def report_results(results: Dict, scores_dump_path: str):
    results = stringify_keys(results)
    dump_to_json_file(results, scores_dump_path)