related to #7153. testing new feature "add_hash" of _anon_label which adds an additional integer value as part of what the anon label is deduplicated upon.
(self)
| 2719 | ) |
| 2720 | |
| 2721 | def test_deduping_hash_algo(self): |
| 2722 | """related to #7153. |
| 2723 | |
| 2724 | testing new feature "add_hash" of _anon_label which adds an additional |
| 2725 | integer value as part of what the anon label is deduplicated upon. |
| 2726 | |
| 2727 | """ |
| 2728 | |
| 2729 | class Thing(ColumnElement): |
| 2730 | def __init__(self, hash_): |
| 2731 | self._hash = hash_ |
| 2732 | |
| 2733 | def __hash__(self): |
| 2734 | return self._hash |
| 2735 | |
| 2736 | t1 = Thing(10) |
| 2737 | t2 = Thing(11) |
| 2738 | |
| 2739 | # this is the collision case. therefore we assert that this |
| 2740 | # add_hash has to be below 16 bits. |
| 2741 | # eq_( |
| 2742 | # t1._anon_label('hi', add_hash=65537), |
| 2743 | # t2._anon_label('hi', add_hash=1) |
| 2744 | # ) |
| 2745 | with expect_raises(AssertionError): |
| 2746 | t1._anon_label("hi", add_hash=65536) |
| 2747 | |
| 2748 | for i in range(50): |
| 2749 | ne_( |
| 2750 | t1._anon_label("hi", add_hash=i), |
| 2751 | t2._anon_label("hi", add_hash=1), |
| 2752 | ) |
| 2753 | |
| 2754 | def test_deduping_unique_across_selects(self): |
| 2755 | """related to #7153 |
nothing calls this directly
no test coverage detected