summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-13 16:50:01 (GMT)
committerWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-25 06:43:11 (GMT)
commit377c79b28c1a7f431c5f6dce045193d907f9be1e (patch)
tree896aaa613ed8b8f05539760d05925128d9712e3f
parent9252d6aeea5b91fcbbe4a19883bee51e73b34c56 (diff)
Tile: assert that there are no duplicates
-rw-r--r--src/tile.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tile.py b/src/tile.py
index 42e9d95..9d77d41 100644
--- a/src/tile.py
+++ b/src/tile.py
@@ -130,7 +130,11 @@ class Tile(str):
for key in (
result, (str(result),), (result.group, result.value),
(result[0], result[1])):
- result.cache[key] = result
+ cls.cache[key] = result
+
+ existing = list([x for x in cls.cache.values() if x.key == result.key])
+ existingIds = set(id(x) for x in existing)
+ assert len(existingIds) == 1, 'new is:{} existing are: {} with ids {}'.format(result, existing, existingIds)
result.exposed = result.concealed = result.swapped = None
result.single = result.pair = result.pung = None