def test_delete_get(self):
        dictionary = Dictionary().set(key=1, value=2)
        dictionary.delete(key=1)
        value = dictionary.get(key=1)

        self.assertEqual(None, value,
                         "delete_get did not have the right value")
示例#2
0
def test_remove():
    print(__name__, "@" * 25)
    print(sys._getframe().f_code.co_name)
    print(__name__, "@" * 25)
    states = Dictionary()
    states.set('Oregon', 'OR')

    states.set('California', 'CA')
    states.set('New York', 'NY')
    states.set('Michigan', 'MI')

    states.list()

    _state = states.get('New York')
    assert (_state == 'NY')

    states.delete("New York")
    states.delete("Oregon")

    states.list()
    _state = states.get('Oregon')
    assert (_state == None)

    _state = states.get('New York')
    assert (_state == None)
示例#3
0
def test_delete():
    cars = Dictionary()
    cars.set('WRX', 'Subaru')
    cars.set('Cherokee', 'Jeep')
    cars.set('Tacoma', 'Toyota')
    assert cars.get('Cherokee') == 'Jeep'
    cars.delete('Cherokee')
    assert cars.get('Cherokee') == None
def test_delete():
    map_buckets = Dictionary()
    bucket_object = map_buckets.get_bucket('fruit')
    map_buckets.set_key_to_value('fruit', 'banana')
    map_buckets.delete('fruit')
    assert map_buckets.get_node_value('fruit') is None