@@ -328,70 +328,32 @@ def test_load_data_load_recs_module1(parse):
328328
329329@pytest .mark .test_sensor_app_load_data_return_module1
330330def test_sensor_app_load_data_return_module1 (parse ):
331- # First, let's verify the user did not accidentally deleted
332- # the two lines provided for them.
333-
331+ # from load_data import load_sensor_data
334332 # data = [] # list to store data read from files
335333 # print("Sensor Data App")
336-
337- sensor = parse ("sensor_app" )
338- assert sensor .success , sensor .message
339-
340- original_data = (
341- sensor .assign_ ().match (
342- {
343- "0_type" : "Assign" ,
344- "0_targets_0_type" : "Name" ,
345- "0_targets_0_id" : "data" ,
346- "0_value_type" : "List" ,
347- }
348- )
349- .exists ()
350- )
351- assert (
352- original_data
353- ), """Do you have a `data` variable set to an empty list on top of the file?
354- You need to have these two lines of code before you being testing Module1
355- data = []
356- print("Sensor Data App")
357- """
334+ #
335+ # data = load_sensor_data()
336+ # print("Loaded records {}".format(len(data)))
358337
359- print_app = (
360- sensor .calls ().match (
361- {
362- "type" : "Expr" ,
363- "value_type" : "Call" ,
364- "value_func_type" : "Name" ,
365- "value_func_id" : "print" ,
366- "value_args_0_type" : "Constant" ,
367- "value_args_0_value" : "Sensor Data App"
368- }
369- )
370- .exists ()
371- )
372- assert (
373- print_app
374- ), """Do you have a `print("Sensor Data App")` statement?
375- You need to have these two lines of code before you being testing Module1
376- data = []
377- print("Sensor Data App")"""
338+ test_file = "sensor_app"
339+ test_class = "HouseInfo"
340+ test_method = "__init__"
378341
379-
380- ######################################################
381- # Now we can test the actual module
382- ######################################################
342+ my_file = parse (test_file )
343+ assert my_file .success , my_file .message
383344
384- # from load_data import load_sensor_data
385- # data = load_sensor_data()
386- # print("Loaded records {}".format(len(data)))
387345
388- load_sensor_data_import = sensor .from_imports (
346+ my_file_import = my_file .from_imports (
389347 "load_data" , "load_sensor_data" )
390- assert load_sensor_data_import , "Are you importing `load_sensor_data` from load_data?"
348+ assert my_file_import , "Are you importing `load_sensor_data` from ` load_data` ?"
391349
392350 data = (
393- sensor .assign_ ().match (
351+ my_file .assign_ ().match (
394352 {
353+ "0_type" : "Assign" ,
354+ "0_targets_0_type" : "Name" ,
355+ "0_targets_0_id" : "data" ,
356+ "0_value_type" : "List" ,
395357 "1_type" : "Assign" ,
396358 "1_targets_0_type" : "Name" ,
397359 "1_targets_0_id" : "data" ,
@@ -404,4 +366,8 @@ def test_sensor_app_load_data_return_module1(parse):
404366 )
405367 assert (
406368 data
407- ), "Are you creating a variable called `data` set equal to `load_sensor_data()` function?"
369+ ), """Do you have a `data` variable set to an empty list on top of the file?
370+ Did you delete the starting code ?
371+ data = []
372+ print("Sensor Data App")
373+ In a new line, are you setting `data` to `load_sensor_data()` function call?"""
0 commit comments