Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_codecmaps_tw.py @ 87690:66c1c9f32567 default tip
Add use_weakref option to functools.lru_cache
The use_weakref option makes lru_cache create weak references to the function
arguments when creating the cache key, which prevents them from staying in the
memory forever even after all other references to them are gone.
This is a proof of concept for http://bugs.python.org/issue19859
| author | Radomir Dopieralski <devel@sheep.art.pl> |
|---|---|
| date | Tue, 03 Dec 2013 16:02:48 +0100 |
| parents | 46a620c87db8 |
| children |
| rev | line source |
|---|---|
|
59522
fcfe324663a6
convert shebang lines: python -> python3
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
1 #!/usr/bin/env python3 |
|
31386
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
2 # |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
3 # test_codecmaps_tw.py |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
4 # Codec mapping tests for ROC encodings |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
5 # |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
6 |
|
47201
9c930a32cebb
#2621 rename test.test_support to test.support
Benjamin Peterson <benjamin@python.org>
parents:
42352
diff
changeset
|
7 from test import support |
|
76178
46a620c87db8
Rename test_ file that is really a support file to remove test_ prefix.
R David Murray <rdmurray@bitdance.com>
parents:
71247
diff
changeset
|
8 from test import multibytecodec_support |
|
31386
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
9 import unittest |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
10 |
|
76178
46a620c87db8
Rename test_ file that is really a support file to remove test_ prefix.
R David Murray <rdmurray@bitdance.com>
parents:
71247
diff
changeset
|
11 class TestBIG5Map(multibytecodec_support.TestBase_Mapping, |
|
31386
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
12 unittest.TestCase): |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
13 encoding = 'big5' |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
14 mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/OBSOLETE/' \ |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
15 'EASTASIA/OTHER/BIG5.TXT' |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
16 |
|
76178
46a620c87db8
Rename test_ file that is really a support file to remove test_ prefix.
R David Murray <rdmurray@bitdance.com>
parents:
71247
diff
changeset
|
17 class TestCP950Map(multibytecodec_support.TestBase_Mapping, |
|
31386
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
18 unittest.TestCase): |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
19 encoding = 'cp950' |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
20 mapfileurl = 'http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/' \ |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
21 'WINDOWS/CP950.TXT' |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
22 pass_enctest = [ |
|
42352
640952df4431
Tweaks to make the codecmaps tests pass again.
Guido van Rossum <guido@python.org>
parents:
41575
diff
changeset
|
23 (b'\xa2\xcc', '\u5341'), |
|
640952df4431
Tweaks to make the codecmaps tests pass again.
Guido van Rossum <guido@python.org>
parents:
41575
diff
changeset
|
24 (b'\xa2\xce', '\u5345'), |
|
31386
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
25 ] |
|
71247
16cbd84de848
Issue #12016: Multibyte CJK decoders now resynchronize faster
Victor Stinner <victor.stinner@haypocalc.com>
parents:
59522
diff
changeset
|
26 codectests = ( |
|
16cbd84de848
Issue #12016: Multibyte CJK decoders now resynchronize faster
Victor Stinner <victor.stinner@haypocalc.com>
parents:
59522
diff
changeset
|
27 (b"\xFFxy", "replace", "\ufffdxy"), |
|
16cbd84de848
Issue #12016: Multibyte CJK decoders now resynchronize faster
Victor Stinner <victor.stinner@haypocalc.com>
parents:
59522
diff
changeset
|
28 ) |
|
31386
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
29 |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
30 def test_main(): |
|
47201
9c930a32cebb
#2621 rename test.test_support to test.support
Benjamin Peterson <benjamin@python.org>
parents:
42352
diff
changeset
|
31 support.run_unittest(__name__) |
|
31386
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
32 |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
33 if __name__ == "__main__": |
|
887ce39f95f2
Add CJK codecs support as discussed on python-dev. (SF #873597)
Hye-Shik Chang <hyeshik@gmail.com>
parents:
diff
changeset
|
34 test_main() |
