from .. import intern

def test_global_interning():
    try:
        intern.global_intern("hello")
    except AssertionError as e:
        pass
    else:
        raise Exception("Expects complaint about uninitialized table")

    intern.global_intern_initialize()
    id1 = intern.global_intern("hello")
    id2 = intern.global_intern("hello")
    id3 = intern.global_intern("hallo")
    assert id1 == id2
    assert id1 != id3

def test_interning():
    table = intern.InternTable()

    id1 = intern.global_intern("hello")
    id2 = intern.global_intern("hello")
    id3 = intern.global_intern("hallo")
    assert id1 == id2
    assert id1 != id3

@@ -622,28 +622,298 @@
 = id2%0A    assert id1 != id3%0A
+%0Adef test_intern_many():%0A    table = intern.InternTable()%0A%0A    for i in range(1000000):%0A        table.global_intern(%22my randrom string %25d%22 %25 i)%0A        table.global_intern(%22my randrom string %25d%22 %25 (i // 2))%0A        table.global_intern(%22my randrom string %25d%22 %25 (i // 4))%0A

Add more thorough intern test