예제 #1
0
 def test_femtometers_break2(self):
     """
     This is a break test of femtometers() for a string
     """
     try:
         angstroms_to.femtometers(['Test String', 'Test Two'])
         print('{:.40s}{}'.format(
             sys._getframe().f_code.co_name + self.padding, self.failed))
     except SystemExit:
         print('{:.40s}{}'.format(
             sys._getframe().f_code.co_name + self.padding, self.passed))
예제 #2
0
 def test_femtometers_list(self):
     """
     This is a functional test of femtometers() with a scalar input
     """
     try:
         angstroms_to.femtometers([1.0, 2.0, 3.0, 4.0, 5.0])
         print('{:.40s}{}'.format(
             sys._getframe().f_code.co_name + self.padding, self.passed))
     except SystemExit:
         print('{:.40s}{}'.format(
             sys._getframe().f_code.co_name + self.padding, self.failed))
예제 #3
0
 def test_femtometers_array(self):
     """
     This is a functional test of femtometers() with array input
     """
     try:
         angstroms_to.femtometers(np.linspace(1.0, 5.0, num=5))
         print('{:.40s}{}'.format(
             sys._getframe().f_code.co_name + self.padding, self.passed))
     except SystemExit:
         print('{:.40s}{}'.format(
             sys._getframe().f_code.co_name + self.padding, self.failed))
예제 #4
0
 def test_femtometers_validate_scalar(self):
     """
     This is a validation test of attometers() for a calar variable
     """
     femtometer = angstroms_to.femtometers(1.0)
     try:
         self.assertTrue(
             math.isclose(femtometer, 1.0e5, rel_tol=self.accepted_error))
         print('{:.40s}{}'.format(
             sys._getframe().f_code.co_name + self.padding, self.passed))
     except AssertionError:
         print('{:.40s}{}'.format(
             sys._getframe().f_code.co_name + self.padding, self.failed))
예제 #5
0
 def test_femtometers_validate_array(self):
     """
     This is a validation test of femtometers() for an array variable
     """
     femtometer = angstroms_to.femtometers(np.array([1.0, 2.0, 3.0, 4.0]))
     comparison = np.array([1.0e5, 2.0e5, 3.0e5, 4.0e5])
     try:
         for i in range(len(comparison)):
             self.assertTrue(
                 math.isclose(femtometer[i],
                              comparison[i],
                              rel_tol=self.accepted_error))
         print('{:.40s}{}'.format(
             sys._getframe().f_code.co_name + self.padding, self.passed))
     except AssertionError:
         print('{:.40s}{}'.format(
             sys._getframe().f_code.co_name + self.padding, self.failed))