示例#1
0
    def testIterValues(self):
        td = _Dict()
        obj = {}
        mock = Mock(None)
        td[obj] = mock

        assert td.values() == [mock]
示例#2
0
    def testIterValues(self):
        td = _Dict()
        obj = {}
        mock = Mock(None)
        td[obj] = mock

        assert td.values() == [mock]
示例#3
0
    def testGetValueForKey(self):
        td = _Dict()
        obj = {}
        mock = Mock(None)
        td[obj] = mock

        assert td.get(obj) == mock
示例#4
0
    def testGetValueForKey(self):
        td = _Dict()
        obj = {}
        mock = Mock(None)
        td[obj] = mock

        assert td.get(obj) == mock
示例#5
0
    def testClear(self):
        td = _Dict()
        obj = {}
        mock = Mock(None)
        td[obj] = mock

        td.clear()
        assert td.get(obj) is None
示例#6
0
    def testPopKey(self):
        td = _Dict()
        obj = {}
        mock = Mock(None)
        td[obj] = mock

        assert td.pop(obj) == mock
        assert td.get(obj) is None
示例#7
0
    def testClear(self):
        td = _Dict()
        obj = {}
        mock = Mock(None)
        td[obj] = mock

        td.clear()
        assert td.get(obj) is None
示例#8
0
    def testPopKey(self):
        td = _Dict()
        obj = {}
        mock = Mock(None)
        td[obj] = mock

        assert td.pop(obj) == mock
        assert td.get(obj) is None
示例#9
0
    def testReplaceValueForSameKey(self):
        td = _Dict()
        obj = {}
        mock1 = Mock(None)
        mock2 = Mock(None)
        td[obj] = mock1
        td[obj] = mock2

        assert td.pop(obj) == mock2
        with pytest.raises(KeyError):
            td.pop(obj)
示例#10
0
    def testReplaceValueForSameKey(self):
        td = _Dict()
        obj = {}
        mock1 = Mock(None)
        mock2 = Mock(None)
        td[obj] = mock1
        td[obj] = mock2

        assert td.pop(obj) == mock2
        with pytest.raises(KeyError):
            td.pop(obj)
示例#11
0
    def testAssignKeyValuePair(self):
        td = _Dict()
        obj = {}
        mock = Mock(None)

        td[obj] = mock
示例#12
0
    def testAssignKeyValuePair(self):
        td = _Dict()
        obj = {}
        mock = Mock(None)

        td[obj] = mock