@@ -443,8 +443,9 @@ def test_sensor_app_house_info_by_area_module2(parse):
443443 # from house_info import HouseInfo
444444 # ...
445445 # house_info = HouseInfo(data)
446- # recs = house_info.get_data_by_area("id", rec_area=1)
447- # print("House sensor records for area 1 = {}".format(len(recs))) # NOT TEST IT
446+ # test_area = 1
447+ # recs = house_info.get_data_by_area("id", rec_area=test_area)
448+ # print("\nHouse sensor records for area {} = {}".format(test_area, len(recs)))
448449
449450 test_file = "sensor_app"
450451
@@ -481,29 +482,35 @@ def test_sensor_app_house_info_by_area_module2(parse):
481482 test_code = (
482483 my_file .assign_ ().match (
483484 {
484- "3_type" : "Assign" ,
485- "3_targets_0_type" : "Name" ,
486- "3_targets_0_id" : "recs" ,
487- "3_value_type" : "Call" ,
488- "3_value_func_type" : "Attribute" ,
489- "3_value_func_value_type" : "Name" ,
490- "3_value_func_value_id" : "house_info" ,
491- "3_value_func_attr" : "get_data_by_area" ,
492- "3_value_args_0_type" : "Constant" ,
493- "3_value_args_0_value" : "id" ,
494- "3_value_keywords_0_type" : "keyword" ,
495- "3_value_keywords_0_arg" : "rec_area" ,
496- "3_value_keywords_0_value_type" : "Constant" ,
497- "3_value_keywords_0_value_value" : 1 ,
485+ "3_type" : "Assign" ,
486+ "3_targets_0_type" : "Name" ,
487+ "3_targets_0_id" : "test_area" ,
488+ "3_value_type" : "Constant" ,
489+ "3_value_value" : 1 ,
490+ "4_type" : "Assign" ,
491+ "4_targets_0_type" : "Name" ,
492+ "4_targets_0_id" : "recs" ,
493+ "4_value_type" : "Call" ,
494+ "4_value_func_type" : "Attribute" ,
495+ "4_value_func_value_type" : "Name" ,
496+ "4_value_func_value_id" : "house_info" ,
497+ "4_value_func_attr" : "get_data_by_area" ,
498+ "4_value_args_0_type" : "Constant" ,
499+ "4_value_args_0_value" : "id" ,
500+ "4_value_keywords_0_type" : "keyword" ,
501+ "4_value_keywords_0_arg" : "rec_area" ,
502+ "4_value_keywords_0_value_type" : "Name" ,
503+ "4_value_keywords_0_value_id" : "test_area" ,
498504 }
499505 )
500506 .exists ()
501507 )
502508 assert (
503509 test_code
504- ), """Are you creating a variable `recs` and setting it to `house_info.get_data_by_area()`?
510+ ), """Are you creating a variable called `test_area` and setting it to 1?
511+ Are you creating a variable `recs` and setting it to `house_info.get_data_by_area()`?
505512 Are you passing `"id"` as the first argument to the method?
506- Are you passing `rec_area=1 ` as the second argument to the method?"""
513+ Are you passing `rec_area=test_area ` as the second argument to the method?"""
507514
508515
509516@pytest .mark .test_sensor_app_house_info_by_date_module2
@@ -526,51 +533,52 @@ def test_sensor_app_house_info_by_date_module2(parse):
526533 my_file_import = my_file .from_imports (
527534 "datetime" , "date" )
528535 assert my_file_import , "Are you importing `date` from `datetime` module?"
536+
529537
530538 # debug_test_case(my_file)
531539
532540 test_code = (
533541 my_file .assign_ ().match (
534542 {
535- "4_type " : "Assign" ,
536- "4_targets_0_type " : "Name" ,
537- "4_targets_0_id " : "test_date" ,
538- "4_value_type " : "Call" ,
539- "4_value_func_type " : "Attribute" ,
540- "4_value_func_value_type " : "Name" ,
541- "4_value_func_value_id " : "datetime" ,
542- "4_value_func_attr " : "strptime" ,
543- "4_value_args_0_type " : "Constant" ,
544- "4_value_args_0_value " : "5/9/20" ,
545- "4_value_args_1_type " : "Constant" ,
546- "4_value_args_1_value " : "%m/%d/%y" ,
543+ "5_type " : "Assign" ,
544+ "5_targets_0_type " : "Name" ,
545+ "5_targets_0_id " : "test_date" ,
546+ "5_value_type " : "Call" ,
547+ "5_value_func_type " : "Attribute" ,
548+ "5_value_func_value_type " : "Name" ,
549+ "5_value_func_value_id " : "datetime" ,
550+ "5_value_func_attr " : "strptime" ,
551+ "5_value_args_0_type " : "Constant" ,
552+ "5_value_args_0_value " : "5/9/20" ,
553+ "5_value_args_1_type " : "Constant" ,
554+ "5_value_args_1_value " : "%m/%d/%y" ,
547555 }
548556 )
549557 .exists ()
550558 )
551559 assert (
552560 test_code
553561 ), """Are you creating an instance of the `datetime` class called `test_date`
562+
554563 which takes `"5/9/20"` and `"%m/%d/%y"` as the two arguments?"""
555564
556565 test_code = (
557566 my_file .assign_ ().match (
558567 {
559- "5_type" : "Assign" ,
560- "5_targets_0_type" : "Name" ,
561- "5_targets_0_id" : "recs" ,
562- "5_value_type" : "Call" ,
563- "5_value_func_type" : "Attribute" ,
564- "5_value_func_value_type" : "Name" ,
565- "5_value_func_value_id" : "house_info" ,
566- "5_value_func_attr" : "get_data_by_date" ,
567- "5_value_args_0_type" : "Constant" ,
568- "5_value_args_0_value" : "id" ,
569- "5_value_keywords_0_type" : "keyword" ,
570- "5_value_keywords_0_arg" : "rec_date" ,
571- "5_value_keywords_0_value_type" : "Name" ,
572- "5_value_keywords_0_value_id" : "test_date"
573-
568+ "6_type" : "Assign" ,
569+ "6_targets_0_type" : "Name" ,
570+ "6_targets_0_id" : "recs" ,
571+ "6_value_type" : "Call" ,
572+ "6_value_func_type" : "Attribute" ,
573+ "6_value_func_value_type" : "Name" ,
574+ "6_value_func_value_id" : "house_info" ,
575+ "6_value_func_attr" : "get_data_by_date" ,
576+ "6_value_args_0_type" : "Constant" ,
577+ "6_value_args_0_value" : "id" ,
578+ "6_value_keywords_0_type" : "keyword" ,
579+ "6_value_keywords_0_arg" : "rec_date" ,
580+ "6_value_keywords_0_value_type" : "Name" ,
581+ "6_value_keywords_0_value_id" : "test_date" ,
574582 }
575583 )
576584 .exists ()
0 commit comments