예제 #1
0
 def test_single_speed_false(self):
     '''
     Test that identifies is not a single speed bike
     '''
     result = q.Bicycle([50, 34],
                        [11, 12, 13, 14, 15, 17, 19, 21, 23, 25, 28])
     self.assertFalse(result.is_single_speed())
예제 #2
0
 def test_gear_inches(self):
     '''
     Test calculating gear inches
     '''
     result = q.Bicycle([50, 34],
                        [11, 12, 13, 14, 15, 17, 19, 21, 23, 25, 28])
     self.assertAlmostEqual(result.get_gear_inches(), 32.79, places=2)
예제 #3
0
 def test_attributes(self):
     '''
     Test setting attributes
     '''
     result = q.Bicycle([50, 34],
                        [11, 12, 13, 14, 15, 17, 19, 21, 23, 25, 28])
     self.assertListEqual(result.front_chainring_values, [34, 50])
예제 #4
0
 def test_set_front_invalid(self):
     '''
     Test that front set with an invalid input raises error
     '''
     with self.assertRaises(ValueError):
         result = q.Bicycle([50, 34],
                            [11, 12, 13, 14, 15, 17, 19, 21, 23, 25, 28])
         result.set_front_chainring(4)
예제 #5
0
 def test_set_front_valid(self):
     '''
     Test that front is set with a valid input
     '''
     result = q.Bicycle([50, 34],
                        [11, 12, 13, 14, 15, 17, 19, 21, 23, 25, 28])
     result.set_front_chainring(2)
     self.assertEqual(result.current_chainring, 2)
예제 #6
0
 def test_set_rear_invalid(self):
     '''
     Test that rear set with an invalid input raises error
     '''
     with self.assertRaises(ValueError):
         result = q.Bicycle([50, 34],
                            [11, 12, 13, 14, 15, 17, 19, 21, 23, 25, 28])
         result.set_rear_cog(-1)
예제 #7
0
 def test_set_rear_valid(self):
     '''
     Test that rear is set with a valid input
     '''
     result = q.Bicycle([50, 34],
                        [11, 12, 13, 14, 15, 17, 19, 21, 23, 25, 28])
     result.set_rear_cog(4)
     self.assertEqual(result.current_rear_cog, 4)
예제 #8
0
 def test_single_speed_true(self):
     '''
     Test that identifies is a single speed bike
     '''
     result = q.Bicycle([50], [19])
     self.assertTrue(result.is_single_speed())