예제 #1
0
 def test___len__(self):
     mock_map = collections.FreezableDict({
         "hmm": "blam",
         "cat": "bag",
         "ok": "bye"
     })
     assert len(mock_map) == 3
예제 #2
0
 def test___init___with_source(self):
     mock_map = collections.FreezableDict({
         "o": "NO",
         "bye": "blam",
         "foo": "bar"
     })
     assert mock_map == {"o": "NO", "bye": "blam", "foo": "bar"}
예제 #3
0
 def test____iter__(self):
     mock_map = collections.FreezableDict({
         "curiosity": "rover",
         "cat": "bag",
         "ok": "bye"
     })
     assert list(mock_map) == ["curiosity", "cat", "ok"]
예제 #4
0
    def test_copy(self):
        mock_map = collections.FreezableDict({"foo": "bar", "crash": "balloon"})
        result = mock_map.copy()

        assert result == {"foo": "bar", "crash": "balloon"}
        assert isinstance(result, collections.FreezableDict)
        assert result is not mock_map
예제 #5
0
    def test_clear(self):
        mock_map = collections.FreezableDict({
            "foo": "bar",
            "crash": "balloon"
        })
        mock_map.clear()

        assert mock_map._data == {}
예제 #6
0
    def test___delitem__(self):
        mock_map = collections.FreezableDict({
            "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 = collections.FreezableDict({
            "hikari": "shinji",
            "gendo": "san"
        })
        result = mock_map.freeze()

        assert result == {"hikari": "shinji", "gendo": "san"}
        assert isinstance(result, dict)
예제 #8
0
    def test___setitem__(self):
        mock_map = collections.FreezableDict({
            "hmm": "forearm",
            "cat": "bag",
            "ok": "bye"
        })
        mock_map["bye"] = 4

        assert mock_map == {
            "hmm": "forearm",
            "cat": "bag",
            "ok": "bye",
            "bye": 4
        }
예제 #9
0
 def test___getitem__(self):
     mock_map = collections.FreezableDict({
         "curiosity": "rover",
         "ok": "bye"
     })
     assert mock_map["ok"] == "bye"