Code: Select all
@property
def env_dict(self) ->dict:
return self.__environ_dict
@env_dict.setter
def env_dict(self, ed: dict) -> None:
self.__environ_dict = {}
if self.__environ_dict:
for k, v in ed:
prefd = str(self.namespace) + '_' + str(k)
self.__environ_dict[prefd] = v
os.environ[prefd] = v
< /code>
Ich versuche einen Test zu schreiben, um zu behaupten, dass die Schlüssel und Werte korrekt sind. Die Assert -Anweisung sieht folgt aus: < /p>
assert ctx.env_dict[0].key == 'SHELLCTX_TESTKEY'