def test_hashing_a_string_with_spaces_and_punctuation(self): mh = NaiveHashTable() self.assertIsNotNone( mh.hash("it's a beautiful day in the \ neighborhood"))
def test_that_i_can_hash_a_string_with_punctuation(self): mh = NaiveHashTable() self.assertIsNotNone(mh.hash("it's"))
def test_that_i_can_hash_a_string_with_punctuation(self): mh = NaiveHashTable() self.assertIsNotNone(mh.hash("it's"))
def test_getting_from_empty_list(self): mh = NaiveHashTable() self.assertRaises(TypeError, lambda: mh.get())
def test_getting_value_from_bucket(self): mh = NaiveHashTable() mh.set('hello', 'world') self.assertEqual(mh.get('hello'), 'world')
def test_storing_a_float(self): mh = NaiveHashTable() mh.set('a float', 1.0) self.assertIsNotNone(mh.get('a float'))
def test_to_see_if_hash_handles_float_keys_correctly(self): mh = NaiveHashTable() self.assertRaises(TypeError, lambda: mh.set(1.0, 'wun poin toe'))
def test_to_see_if_hash_handles_float_keys_correctly(self): mh = NaiveHashTable() self.assertRaises(TypeError, lambda: mh.set(1.0, 'wun poin toe'))
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_to_see_if_hash_handles_nonstring_keys_correctly(self): # passes mh = NaiveHashTable() self.assertRaises(TypeError, lambda: mh.set(123, 'wun to tree'))
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_hashing_a_string_with_spaces_and_punctuation(self): mh = NaiveHashTable() self.assertIsNotNone(mh.hash("it's a beautiful day in the \ neighborhood"))
def test_storing_string_in_a_bucket(self): mh = NaiveHashTable() mh.set('hello', 'world') self.assertIsNotNone(mh.get('hello'))
def test_getting_nonexistant_key(self): mh = NaiveHashTable() mh.set('dog', 'food') self.assertRaises(TypeError, lambda:mh.get('cat'))
def test_storing_an_int(self): mh = NaiveHashTable() mh.set('an integer', 1) self.assertIsNotNone(mh.get('an integer'))
def test_to_see_if_i_hash_keys_correctly(self): # passes mh = NaiveHashTable() self.assertEqual(mh.hash('hello'), 2)
def test_to_see_if_hash_handles_nonstring_keys_correctly(self): # passes mh = NaiveHashTable() self.assertRaises(TypeError, lambda: mh.set(123, 'wun to tree'))
def test_getting_value_from_bucket(self): mh = NaiveHashTable() mh.set('hello', 'world') self.assertEqual(mh.get('hello'), 'world')
def test_to_see_if_i_hash_keys_correctly(self): # passes mh = NaiveHashTable() self.assertEqual(mh.hash('hello'), 2)
def test_getting_string_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('than wisdom'), 'lady i swear by all the ' 'flowers')
def test_getting_nonexistant_key(self): mh = NaiveHashTable() mh.set('dog', 'food') self.assertRaises(TypeError, lambda: mh.get('cat'))
def test_that_i_can_hash_a_string_with_spaces(self): mh = NaiveHashTable() self.assertIsNotNone(mh.hash('hello dave'))
def test_getting_string_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('than wisdom'), 'lady i swear by all the ' 'flowers')
def test_that_i_can_hash_a_string_with_spaces(self): mh = NaiveHashTable() self.assertIsNotNone(mh.hash('hello dave'))