Ejemplo n.º 1
0
def test_signs_get(client, sign_repository):
    sign = Sign(SignName("test"))
    sign_repository.create(sign)
    result = client.simulate_get(f"/signs/{sign.name}")

    assert result.json == SignDtoSchema().dump(sign)
    assert result.status == falcon.HTTP_OK
Ejemplo n.º 2
0
def test_sign_dto_schema():
    sign = Sign(
        SignName("KUR"),
        (SignListRecord("ABZ", "03+53"), ),
        (Value("kur", 3), Value("ruk")),
    )
    expected = {
        "name": "KUR",
        "lists": [{
            "name": "ABZ",
            "number": "03+53"
        }],
        "values": [{
            "value": "kur",
            "subIndex": 3
        }, {
            "value": "ruk"
        }],
        "mesZl": "",
        "LaBaSi": "",
        "unicode": [],
        "logograms": [],
        "fossey": [],
    }
    assert SignDtoSchema().dump(sign) == expected
Ejemplo n.º 3
0
def test_sign_schema():
    data = {
        "_id": "KUR",
        "lists": [{
            "name": "ABZ",
            "number": "03+53"
        }],
        "values": [{
            "value": "kur",
            "subIndex": 3
        }, {
            "value": "ruk"
        }],
        "unicode": [],
        "mesZl": "",
        "LaBaSi": "",
        "logograms": [],
        "fossey": [],
    }
    sign = Sign(
        SignName("KUR"),
        (SignListRecord("ABZ", "03+53"), ),
        (Value("kur", 3), Value("ruk")),
    )
    assert SignSchema().dump(sign) == data
    assert SignSchema().load(data) == sign
 def make_sign(self, data, **kwargs) -> Sign:
     data["lists"] = tuple(data["lists"])
     data["values"] = tuple(data["values"])
     data["logograms"] = tuple(data["logograms"])
     data["fossey"] = tuple(data["fossey"])
     data["unicode"] = tuple(data["unicode"])
     return Sign(**data)
def test_standardization_multiple_abz():
    name = "ABZ"
    number = "123"
    sign = Sign(
        SignName("KUR"),
        lists=(SignListRecord(name, number), SignListRecord(name, "999")),
    )
    assert sign.standardization == f"{name}{number}"
def signs():
    return [
        Sign(
            name,
            tuple(
                SignListRecord(list_name, number)
                for list_name, number in lists),
            tuple(
                Value(value_name, sub_index)
                for value_name, sub_index in values),
        ) for name, values, lists in [
            ("P₂", [(":", 1)], [("ABZ", "377n1")]),
            ("KU", [("ku", 1)], [("KWU", "869")]),
            ("NU", [("nu", 1)], [("ABZ", "075")]),
            ("IGI", [("ši", 1)], [("HZL", "288"), ("ABZ", "207a/207b X")]),
            ("DIŠ", [("ana", 1), ("1", 1)], []),
            ("UD", [("u", 4), ("tu", 2)], []),
            ("MI", [("mi", 1), ("gi", 6)], []),
            ("KI", [("ki", 1)], []),
            ("DU", [("du", 1)], []),
            ("U", [("u", 1), ("10", 1)], [("ABZ", "411")]),
            ("|U.U|", [("20", 1)], [("ABZ", "471")]),
            ("BA", [("ba", 1), ("ku", 1)], []),
            ("MA", [("ma", 1)], []),
            ("TI", [("ti", 1)], []),
            ("MU", [("mu", 1)], []),
            ("TA", [("ta", 1)], []),
            ("ŠU", [("šu", 1)], []),
            ("BU", [("gid", 2)], []),
            ("|(4×ZA)×KUR|", [("geštae", 1)], [("ABZ", "531+588")]),
            ("|(AŠ&AŠ@180)×U|", [], []),
            ("|A.EDIN.LAL|", [("ummu", 3)], []),
            ("|HU.HI|", [("mat", 3)], [("ABZ", "081")]),
            ("AŠ", [("ana", 3)], [("ABZ", "001")]),
            ("EDIN", [("bil", None), ("bir", 4)], [("ABZ", "168")]),
            ("|ŠU₂.3×AN|", [("kunga", 1)], []),
            ("BUR₂", [("bul", 1)], [("ABZ", "11")]),
            ("HU", [("u", 18)], [("ABZ", "78")]),
        ]
    ]
def test_sign():
    name = SignName("KUR")
    lists = (SignListRecord("FOO", "123"),)
    values = (Value("kur", 8), Value("ruk"))
    logogram = Logogram(
        "AŠ-IKU", Atf("AŠ-IKU"), ["ikû I"], "AŠ-IKU; *iku* (Deich); ZL 290 (Lit.)"
    )
    fossey = Fossey(
        405,
        25728,
        "B",
        "Mai: MDP, VI, 11.I, 11",
        "Paulus AOAT 50, 981",
        "NABU 1997/1",
        "P123456",
        MuseumNumber("K", "4562"),
        "dcclt",
        "Das Zeichen ist eigentlich ZA₇",
        "Marduk-apla-iddina I, 1171-1159 BC",
        "me-luḫ-ḫa",
        "M15,21.7c-0.1-0.1-0.2-0.4-0.2-0.8c-0.1-1-0.1-1.2-0.5-1.3c-0.2",
    )
    sign = Sign(
        name,
        lists=lists,
        values=values,
        logograms=logogram,
        fossey=fossey,
        mes_zl="test_mesZl",
        labasi="test_LaBaSi",
    )

    assert sign.name == name
    assert sign.lists == lists
    assert sign.values == values
    assert sign.logograms == logogram
    assert sign.fossey == fossey
    assert sign.mes_zl == "test_mesZl"
    assert sign.labasi == "test_LaBaSi"
def test_standardization_no_abz():
    sign = Sign(SignName("KUR"))
    assert sign.standardization == sign.name