예제 #1
0
 def test_hottest_small_n(self):
     """Test hottest with n less than or equal length of dictionary"""
     self.assertEqual(hw4.hottest(self.norcal,2), ['Fresno', 'Sacramento'])
     # Test if the original dictionary is modified
     self.assertEqual(self.norcal, self.unchanged_norcal)
     self.assertEqual(hw4.hottest(self.norcal, 8),
                      ['Fresno','Sacramento','Napa','San Jose',
                       'Mountain View','Los Altos','Palo Alto','Oakland'])
     # Test if the original dictionary is modified
     self.assertEqual(self.norcal, self.unchanged_norcal)
예제 #2
0
 def test_hottest_normal_cases(self):
     """Testing hottest function with arbitrary number of cities"""
     self.assertEqual(hw4.hottest(self.norcal,2), ['Fresno', 'Sacramento'])
     # Test if the original dictionary is modified
     self.assertEqual(self.norcal, self.unchanged_norcal)
     self.assertEqual(hw4.hottest(self.norcal, 8),
                      ['Fresno','Sacramento','Napa','San Jose',
                       'Mountain View','Los Altos','Palo Alto','Oakland'])
     # Test if the original dictionary is modified
     self.assertEqual(self.norcal, self.unchanged_norcal)
예제 #3
0
 def test_hottest_big_n(self):
     """Test hottest with n greater than length of dictionary"""
     self.assertEqual(hw4.hottest(self.norcal,20),
                      ['Fresno', 'Sacramento', 'Napa', 'San Jose',
                       'Mountain View', 'Los Altos', 'Palo Alto',
                       'Oakland', 'San Francisco'])
     # Test if the original dictionary is modified
     self.assertEqual(self.norcal, self.unchanged_norcal)
예제 #4
0
파일: graceTest.py 프로젝트: Kiwibud/hw7
 def test_hottest_small_n(self):
     """Test hottest with n < dictionary length"""
     self.assertEqual(hw4.hottest(self.norcal, 2), ['Fresno', 'Sacramento'])
     self.assertEqual(hw4.hottest(self.norcal, 8), [
         'Fresno', 'Sacramento', 'Napa', 'San Jose', 'Mountain View',
         'Los Altos', 'Palo Alto', 'Oakland'
     ])
     self.assertEqual(hw4.hottest(self.norcal, 2), ['Fresno', 'Sacramento'])
     self.assertEqual(
         self.norcal, {
             'Fresno': 77,
             'Napa': 74,
             'Palo Alto': 70,
             'Sacramento': 75,
             'San Francisco': 64,
             'San Jose': 73,
             'Oakland': 67,
             'Los Altos': 71,
             'Mountain View': 72
         })
예제 #5
0
 def test_hottest_no_modify(self):
     """Tests the to see if hottest the dictionary"""
     self.assertEqual(hw4.hottest(self.norcal, 8), [
         'Fresno', 'Sacramento', 'Napa', 'San Jose', 'Mountain View',
         'Los Altos', 'Palo Alto', 'Oakland'
     ])
     self.assertEqual(
         self.norcal, {
             'Fresno': 77,
             'Napa': 74,
             'Palo Alto': 70,
             'Sacramento': 75,
             'San Francisco': 64,
             'San Jose': 73,
             'Oakland': 67,
             'Los Altos': 71,
             'Mountain View': 72
         })
예제 #6
0
 def test_hottest_nocities(self):
     """Tests hottest with an empty dictionary"""
     self.assertEqual(hw4.hottest(self.no_cities, 6), [])
예제 #7
0
 def test_hottest_twenty(self):
     """Tests to see printing of 20 hottest"""
     self.assertEqual(hw4.hottest(self.norcal, 20), [
         'Fresno', 'Sacramento', 'Napa', 'San Jose', 'Mountain View',
         'Los Altos', 'Palo Alto', 'Oakland', 'San Francisco'
     ])
예제 #8
0
 def test_hottest_more(self):
     """Tests to find 8 hottest cities"""
     self.assertEqual(hw4.hottest(self.norcal, 8), [
         'Fresno', 'Sacramento', 'Napa', 'San Jose', 'Mountain View',
         'Los Altos', 'Palo Alto', 'Oakland'
     ])
예제 #9
0
 def test_hottest_default(self):
     """Tests to find hottest cities defaults to 4"""
     self.assertEqual(hw4.hottest(self.norcal),
                      ['Fresno', 'Sacramento', 'Napa', 'San Jose'])
예제 #10
0
 def test_hottest_few(self):
     """Tests to find a few cities"""
     self.assertEqual(hw4.hottest(self.norcal, 2), ['Fresno', 'Sacramento'])
예제 #11
0
 def test_hottest_omit_n(self):
     """Testing the hottest function without specify integer n"""
     self.assertEqual(hw4.hottest(self.norcal),
                      ['Fresno', 'Sacramento', 'Napa', 'San Jose'])
     # Test if the original dictionary is modified
     self.assertEqual(self.norcal,self.unchanged_norcal)
예제 #12
0
 def test_hottest_no_cites(self):
     """Test the hottest function with empty dictionary"""
     self.assertEqual(hw4.hottest(self.no_cities, 6), [])
     # Test if the original dictionary is modified
     self.assertEqual(self.no_cities, {})
예제 #13
0
파일: graceTest.py 프로젝트: Kiwibud/hw7
 def test_hottest_large_n(self):
     """Test hottest with n > dictionary length"""
     self.assertEqual(hw4.hottest(self.norcal, 20), [
         'Fresno', 'Sacramento', 'Napa', 'San Jose', 'Mountain View',
         'Los Altos', 'Palo Alto', 'Oakland', 'San Francisco'
     ])
예제 #14
0
파일: graceTest.py 프로젝트: Kiwibud/hw7
 def test_hottest_default(self):
     """Test hottest with default value"""
     self.assertEqual(hw4.hottest(self.norcal),
                      ['Fresno', 'Sacramento', 'Napa', 'San Jose'])
예제 #15
0
파일: graceTest.py 프로젝트: Kiwibud/hw7
 def test_hottest_empty(self):
     """Test hottest with empty dictionary"""
     self.assertEqual(hw4.hottest(self.no_cities, 6), [])