Beispiel #1
0
 def test_picometers_break2(self):
     """
     This is a break test of picometers() for a string
     """
     try:
         angstroms_to.picometers(['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))
Beispiel #2
0
 def test_picometers_list(self):
     """
     This is a functional test of picometers() with a scalar input
     """
     try:
         angstroms_to.picometers([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))
Beispiel #3
0
 def test_picometers_array(self):
     """
     This is a functional test of picometers() with array input
     """
     try:
         angstroms_to.picometers(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))
Beispiel #4
0
 def test_picometers_validate_scalar(self):
     """
     This is a validation test of picometers() for a calar variable
     """
     picometer = angstroms_to.picometers(1.0)
     try:
         self.assertTrue(
             math.isclose(picometer, 100, 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))
Beispiel #5
0
 def test_picometers_validate_array(self):
     """
     This is a validation test of picometers() for an array variable
     """
     picometer = angstroms_to.picometers(np.array([1.0, 2.0, 3.0, 4.0]))
     comparison = np.array([100, 200, 300, 400])
     try:
         for i in range(len(comparison)):
             self.assertTrue(
                 math.isclose(picometer[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))