(case_setup_dap, pyfile)
| 1955 | |
| 1956 | |
| 1957 | def test_dict_contents(case_setup_dap, pyfile): |
| 1958 | |
| 1959 | @pyfile |
| 1960 | def check(): |
| 1961 | dct = {"a": 1, "_b_": 2, "__c__": 3} |
| 1962 | print("TEST SUCEEDED") # break here |
| 1963 | |
| 1964 | with case_setup_dap.test_file(check) as writer: |
| 1965 | json_facade = JsonFacade(writer) |
| 1966 | |
| 1967 | json_facade.write_launch(justMyCode=False) |
| 1968 | json_facade.write_set_breakpoints(writer.get_line_index_with_content("break here")) |
| 1969 | json_facade.write_make_initial_run() |
| 1970 | |
| 1971 | json_hit = json_facade.wait_for_thread_stopped() |
| 1972 | json_hit = json_facade.get_stack_as_json_hit(json_hit.thread_id) |
| 1973 | |
| 1974 | variables_response = json_facade.get_variables_response(json_hit.frame_id) |
| 1975 | |
| 1976 | variables_references = variables_response.body.variables |
| 1977 | for dct in variables_references: |
| 1978 | if dct["name"] == "dct": |
| 1979 | break |
| 1980 | else: |
| 1981 | raise AssertionError('Expected to find "dct".') |
| 1982 | ref = dct["variablesReference"] |
| 1983 | |
| 1984 | assert isinstance(ref, int_types) |
| 1985 | # : :type variables_response: VariablesResponse |
| 1986 | |
| 1987 | variables_response = json_facade.get_variables_response(ref) |
| 1988 | variable_names = set(v["name"] for v in variables_response.body.variables) |
| 1989 | for n in ("'a'", "'_b_'", "'__c__'", "len()"): |
| 1990 | assert n in variable_names |
| 1991 | |
| 1992 | json_facade.write_continue() |
| 1993 | writer.finished_ok = True |
| 1994 | |
| 1995 | |
| 1996 | @pytest.mark.skipif(IS_JYTHON, reason="Putting unicode on frame vars does not work on Jython.") |
nothing calls this directly
no test coverage detected