Пример #1
0
    def test_copy(self):
        mock_map = mapping.DictionaryCollection({"foo": "bar", "crash": "balloon"})
        result = mock_map.copy()

        assert result == {"foo": "bar", "crash": "balloon"}
        assert isinstance(result, mapping.DictionaryCollection)
        assert result is not mock_map
Пример #2
0
    def test___setitem__(self):
        mock_map = mapping.DictionaryCollection({"hmm": "forearm", "cat": "bag", "ok": "bye"})
        mock_map["bye"] = 4

        assert mock_map == {"hmm": "forearm", "cat": "bag", "ok": "bye", "bye": 4}
Пример #3
0
 def test___len__(self):
     mock_map = mapping.DictionaryCollection({"hmm": "blam", "cat": "bag", "ok": "bye"})
     assert len(mock_map) == 3
Пример #4
0
 def test____iter__(self):
     mock_map = mapping.DictionaryCollection({"curiosity": "rover", "cat": "bag", "ok": "bye"})
     assert list(mock_map) == ["curiosity", "cat", "ok"]
Пример #5
0
 def test___getitem__(self):
     mock_map = mapping.DictionaryCollection({"curiosity": "rover", "ok": "bye"})
     assert mock_map["ok"] == "bye"
Пример #6
0
    def test___delitem__(self):
        mock_map = mapping.DictionaryCollection({"hikari": "shinji", "gendo": "san", "screwed": "up"})
        del mock_map["hikari"]

        assert mock_map == {"gendo": "san", "screwed": "up"}
Пример #7
0
    def test_freeze(self):
        mock_map = mapping.DictionaryCollection({"hikari": "shinji", "gendo": "san"})
        result = mock_map.freeze()

        assert result == {"hikari": "shinji", "gendo": "san"}
        assert isinstance(result, dict)
Пример #8
0
 def test___init___with_source(self):
     mock_map = mapping.DictionaryCollection({"o": "NO", "bye": "blam", "foo": "bar"})
     assert mock_map == {"o": "NO", "bye": "blam", "foo": "bar"}