()
| 1084 | |
| 1085 | |
| 1086 | def test_tokenize_circular_recursion(): |
| 1087 | a = [1, 2] |
| 1088 | a[0] = a |
| 1089 | |
| 1090 | # Test that tokenization doesn't stop as soon as you hit the circular recursion |
| 1091 | b = [1, 3] |
| 1092 | b[0] = b |
| 1093 | |
| 1094 | assert check_tokenize(a) != check_tokenize(b) |
| 1095 | |
| 1096 | # Different circular recursions tokenize differently |
| 1097 | c = [[], []] |
| 1098 | c[0].append(c[0]) |
| 1099 | c[1].append(c[1]) |
| 1100 | |
| 1101 | d = [[], []] |
| 1102 | d[0].append(d[1]) |
| 1103 | d[1].append(d[0]) |
| 1104 | assert check_tokenize(c) != check_tokenize(d) |
| 1105 | |
| 1106 | # For dicts, the dict itself is not passed to _normalize_seq_func |
| 1107 | e = {} |
| 1108 | e[0] = e |
| 1109 | check_tokenize(e) |
| 1110 | |
| 1111 | |
| 1112 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected