Skip to content

Missing keys in repro of tomlkit.container.OutOfOrderTableProxy #439

@ewjoachim

Description

@ewjoachim

Hello,
Here's a strange one.

From this toml:

a.b.c = "d"
a.b.e = "f"

When we access value["a"], it behaves correctly but the repr is missing the "c" key.

import tomlkit

print(tomlkit.__version__)
# 0.13.3

a = tomlkit.parse("""
a.b.c = "d"
a.b.e = "f"
""")
assert a == {"a": {"b": {"c": "d", "e": "f"}}}  # ok
value = a["a"]
expected = {"b": {"c": "d", "e": "f"}}
assert value == expected  # ok

print(value)
# {'b': {'e': 'f'}}
print(expected)
# {'b': {'c': 'd', 'e': 'f'}}

assert repr(value) == repr(expected)
# Traceback (most recent call last):
#   File "/Users/joachim/code/raincoat2/oops.py", line 19, in <module>
#     assert repr(value) == repr(expected)
#            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# AssertionError

As far as I can tell, this doesn't happen on a, only on a["a"].
I've tried to simplify the issue as much as possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions