def test_getting_float_from_full_list(self):
     mh = NaiveHashTable()
     mh.set('i am not that', 1337)
     mh.set("who's hungry for", 3.14)
     mh.set('since feeling is first', 'who pays any attention to the')
     mh.set('syntax of things', 'will never wholly kiss you')
     mh.set('wholly to be a fool', 'while spring is in the world')
     mh.set('my blood approves', 'and kisses are a better fate')
     mh.set('than wisdom', 'lady i swear by all the flowers')
     mh.set('don\'t cry', 'the best gesture of my brain is less than')
     mh.set('your eyelid\'s flutter', 'which says')
     mh.set('we are for each other then', 'laugh, leaning back in my arms')
     mh.set('for life\'s not a paragraph', 'and death i think is no \
             parenthesis')
     mh.set('by', 'ee cummings')
     self.assertEqual(mh.get('who\'s hungry for'), 3.14)
 def test_getting_float_from_full_list(self):
     mh = NaiveHashTable()
     mh.set('i am not that', 1337)
     mh.set("who's hungry for", 3.14)
     mh.set('since feeling is first', 'who pays any attention to the')
     mh.set('syntax of things', 'will never wholly kiss you')
     mh.set('wholly to be a fool', 'while spring is in the world')
     mh.set('my blood approves', 'and kisses are a better fate')
     mh.set('than wisdom', 'lady i swear by all the flowers')
     mh.set('don\'t cry', 'the best gesture of my brain is less than')
     mh.set('your eyelid\'s flutter', 'which says')
     mh.set('we are for each other then', 'laugh, leaning back in my arms')
     mh.set('for life\'s not a paragraph', 'and death i think is no \
             parenthesis')
     mh.set('by', 'ee cummings')
     self.assertEqual(mh.get('who\'s hungry for'), 3.14)
 def test_getting_value_from_bucket(self):
     mh = NaiveHashTable()
     mh.set('hello', 'world')
     self.assertEqual(mh.get('hello'), 'world')
 def test_getting_nonexistant_key(self):
     mh = NaiveHashTable()
     mh.set('dog', 'food')
     self.assertRaises(TypeError, lambda: mh.get('cat'))
 def test_getting_from_empty_list(self):
     mh = NaiveHashTable()
     self.assertRaises(TypeError, lambda: mh.get())
 def test_storing_a_float(self):
     mh = NaiveHashTable()
     mh.set('a float', 1.0)
     self.assertIsNotNone(mh.get('a float'))
 def test_storing_an_int(self):
     mh = NaiveHashTable()
     mh.set('an integer', 1)
     self.assertIsNotNone(mh.get('an integer'))
 def test_storing_string_in_a_bucket(self):
     mh = NaiveHashTable()
     mh.set('hello', 'world')
     self.assertIsNotNone(mh.get('hello'))
 def test_getting_value_from_bucket(self):
     mh = NaiveHashTable()
     mh.set('hello', 'world')
     self.assertEqual(mh.get('hello'), 'world')
Esempio n. 10
0
 def test_getting_nonexistant_key(self):
     mh = NaiveHashTable()
     mh.set('dog', 'food')
     self.assertRaises(TypeError, lambda:mh.get('cat'))
Esempio n. 11
0
 def test_getting_from_empty_list(self):
     mh = NaiveHashTable()
     self.assertRaises(TypeError, lambda: mh.get())
Esempio n. 12
0
 def test_storing_a_float(self):
     mh = NaiveHashTable()
     mh.set('a float', 1.0)
     self.assertIsNotNone(mh.get('a float'))
Esempio n. 13
0
 def test_storing_an_int(self):
     mh = NaiveHashTable()
     mh.set('an integer', 1)
     self.assertIsNotNone(mh.get('an integer'))
Esempio n. 14
0
 def test_storing_string_in_a_bucket(self):
     mh = NaiveHashTable()
     mh.set('hello', 'world')
     self.assertIsNotNone(mh.get('hello'))