2023-05-04 15:06:55 +02:00
|
|
|
# Copyright (c) 2023 Thomas Tuerk (kontakt@thomas-tuerk.de)
|
|
|
|
#
|
|
|
|
# This file is part of PyAPplus64 (see https://www.thomas-tuerk.de/de/pyapplus64).
|
|
|
|
#
|
|
|
|
# Use of this source code is governed by an MIT-style
|
|
|
|
# license that can be found in the LICENSE file or at
|
|
|
|
# https://opensource.org/licenses/MIT.
|
|
|
|
|
|
|
|
from PyAPplus64 import applus_db
|
2023-05-06 21:49:04 +02:00
|
|
|
|
2023-05-04 15:06:55 +02:00
|
|
|
|
|
|
|
def test_DBTableIDs1() -> None:
|
2023-05-06 21:49:04 +02:00
|
|
|
ids = applus_db.DBTableIDs()
|
2023-05-04 15:06:55 +02:00
|
|
|
assert (str(ids) == "{}")
|
|
|
|
ids.add("t1", 1)
|
|
|
|
assert (str(ids) == "{'T1': {1}}")
|
2023-05-06 21:49:04 +02:00
|
|
|
ids.add("t1", 2, 3, 4)
|
2023-05-04 15:06:55 +02:00
|
|
|
assert (str(ids) == "{'T1': {1, 2, 3, 4}}")
|
|
|
|
assert (ids.getTable("T1") == {1, 2, 3, 4})
|
|
|
|
assert (ids.getTable("T2") == set())
|
2023-05-06 21:49:04 +02:00
|
|
|
ids.add("t2", 2, 3, 4)
|
|
|
|
assert (ids.getTable("T2") == {2, 3, 4})
|
2023-05-04 15:06:55 +02:00
|
|
|
assert (str(ids) == "{'T1': {1, 2, 3, 4}, 'T2': {2, 3, 4}}")
|