Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from __future__ import print_function 

2from builtins import str 

3import os 

4import unittest 

5import shutil 

6import unittest 

7import yaml 

8from astrocalc.utKit import utKit 

9from fundamentals import tools 

10from os.path import expanduser 

11home = expanduser("~") 

12 

13packageDirectory = utKit("").get_project_root() 

14settingsFile = packageDirectory + "/test_settings.yaml" 

15su = tools( 

16 arguments={"settingsFile": settingsFile}, 

17 docString=__doc__, 

18 logLevel="DEBUG", 

19 options_first=False, 

20 projectName=None, 

21 defaultSettingsFile=False 

22) 

23arguments, settings, log, dbConn = su.setup() 

24 

25# SETUP PATHS TO COMMON DIRECTORIES FOR TEST DATA 

26moduleDirectory = os.path.dirname(__file__) 

27pathToInputDir = moduleDirectory + "/input/" 

28pathToOutputDir = moduleDirectory + "/output/" 

29 

30try: 

31 shutil.rmtree(pathToOutputDir) 

32except: 

33 pass 

34# COPY INPUT TO OUTPUT DIR 

35shutil.copytree(pathToInputDir, pathToOutputDir) 

36 

37# Recursively create missing directories 

38if not os.path.exists(pathToOutputDir): 

39 os.makedirs(pathToOutputDir) 

40 

41 

42class test_coordinates_to_array(unittest.TestCase): 

43 

44 def test_coordinates_to_array(self): 

45 

46 raList = ["13:20:00.00", 200.0, "13:20:00.00", 175.23, 21.36] 

47 decList = ["+24:18:00.00", 24.3, "+24:18:00.00", -28.25, -15.32] 

48 

49 from astrocalc.coords import coordinates_to_array 

50 ra, dec = coordinates_to_array( 

51 log=log, 

52 ra=raList, 

53 dec=decList 

54 ) 

55 

56 print(ra, dec) 

57 

58 from astrocalc.coords import coordinates_to_array 

59 ra, dec = coordinates_to_array( 

60 log=log, 

61 ra="13:20:00.00", 

62 dec="+24:18:00.00" 

63 ) 

64 

65 print(ra, dec) 

66 

67 def test_coordinates_to_array_function_exception(self): 

68 

69 from astrocalc.coords import coordinates_to_array 

70 try: 

71 this = coordinates_to_array( 

72 log=log, 

73 settings=settings, 

74 fakeKey="break the code" 

75 ) 

76 this.get() 

77 assert False 

78 except Exception as e: 

79 assert True 

80 print(str(e)) 

81 

82 # x-print-testpage-for-pessto-marshall-web-object 

83 

84 # x-class-to-test-named-worker-function