예제 #1
0
    def get(self):
        args = parser.parse_args()
        request = args['request']
        request_type = args['request_type']

        results = nlp.parse(request)

        if request_type == "General":
            return general.call(results)
        elif request_type == "Apartments":
            return apartments.call(results)
예제 #2
0
 def testHasGym(self):
     api = parse("Show me all buildings in Richmond, Virginia that have a local gym")
     has_fitness_center = api.get('has_fitness_center')
     self.assertTrue(has_fitness_center)
예제 #3
0
 def test_max_sqft_1(self):
     api = parse("Show me all apartments that are under 60,000 sqft")
     max_sqft = api.get("max_sqft")
     self.assertEqual(max_sqft, '60000')
예제 #4
0
 def testStateFullName(self):
     api = parse("Show me all the apartments in Richmond, Virginia.")
     self.assertEqual(api['state'], "Virginia")
예제 #5
0
 def test_min_sqft_4(self):
     api = parse("Show all apartments that are greater than 2,000 sqft in Richmond")
     self.assertEqual(api['min_sqft'], '2000')
예제 #6
0
 def testZipCodeNoState(self):
     api = parse("List apartments in the 23269 area")
     self.assertEqual(api['zip_code'], '23269')
예제 #7
0
 def testZipCodeAfterState(self):
     api = parse("Show me everything in Richmond, Virginia 23221.")
     self.assertEqual(api['zip_code'], '23221')
예제 #8
0
 def testHasLaundryFacilitiesIndirectlyStated_2(self):
     api = parse("Show me all apartments in Richmond, Virginia that have a washer and dryer")
     has_laundry_facilities = api.get('has_laundry_facilities')
     self.assertEqual(has_laundry_facilities, True)
예제 #9
0
 def testDoesNotHaveAirConditioning(self):
     api = parse("Show me all buildings in Richmond, Virginia that does not have air conditioning")
     has_air_conditioning = api.get("has_air_conditioning")
     self.assertFalse(has_air_conditioning)
예제 #10
0
 def testHasAirConditioning(self):
     api = parse("Show me all buildings in Richmond, Virginia that have air conditioning")
     has_air_conditioning = api.get("has_air_conditioning")
     self.assertTrue(has_air_conditioning)
예제 #11
0
 def testDishWasherIndirectlyStated(self):
     api = parse("Show me all apartments in Richmond, Virginia that have a dish cleaner")
     has_dishwasher = api.get('has_dishwasher')
     self.assertTrue(has_dishwasher)
예제 #12
0
 def testDoesNotHaveDishwasher(self):
     api = parse("Show me all buildings in Richmond, Virginia that do not have a dishwasher")
     has_dishwasher = api.get('has_dishwasher')
     self.assertFalse(has_dishwasher)
예제 #13
0
 def testHasDishwasher(self):
     api = parse("Show me all buildings in Richmond, Virginia that have a dishwasher")
     has_dishwasher = api.get('has_dishwasher')
     self.assertTrue(has_dishwasher)
예제 #14
0
 def test_has_wheelchair_access_3(self):
     api = parse("Show me all buildings in Richmond, Virginia that have handicap access")
     has_wheelchair_access = api.get('has_wheelchair_access')
     self.assertTrue(has_wheelchair_access)
예제 #15
0
 def testDoesNotHaveWheelChairAccess(self):
     api = parse("Show me all buildings in Richmond, Virginia that do not have wheelchair access")
     has_wheelchair_access = api.get('has_wheelchair_access')
     self.assertFalse(has_wheelchair_access)
예제 #16
0
 def testCityNotInCityList(self):
     api = parse("Show me all the 3 bedrooms in New York City, New York")
     with self.assertRaises(KeyError):
         city = api["city"]
예제 #17
0
 def testDoesNotHaveLaundryFacilities(self):
     api = parse("Show me all apartments in Richmond, Virginia that do not have laundry facilities")
     has_laundry_facilities = api.get('has_laundry_facilities')
     self.assertEqual(has_laundry_facilities, False)
예제 #18
0
 def testStateAbbreviation(self):
     api = parse("What rental property is in Charleston, SC.")
     self.assertEqual(api["city"], "Charleston")
예제 #19
0
 def testSameCityAsState(self):
     api = parse("Show me all the 3 bedrooms in New York, New York")
     self.assertEqual(api["city"], "New York")
예제 #20
0
 def testAirConditioningIndirectlyStated(self):
     api = parse("Show me all apartments in Richmond, Virginia that have heating and cooling")
     has_air_conditioning = api.get("has_air_conditioning")
     self.assertTrue(has_air_conditioning)
예제 #21
0
 def testZipCodeByItself(self):
     api = parse("List houses in the 23269 area code of Richmond.")
     self.assertEqual(api['zip_code'], '23269')
예제 #22
0
 def testHasParking(self):
     api = parse("Show me all buildings in Richmond, Virginia that have parking")
     has_parking = api.get("has_parking")
     self.assertTrue(has_parking)
예제 #23
0
 def test_min_sqft_1(self):
     api = parse("Show all 2,000 feet apartments")
     self.assertEqual(api['min_sqft'], '2000')
예제 #24
0
 def testDoesNotHaveParking(self):
     api = parse("Show me all buildings in Richmond, Virginia that do not have parking")
     has_parking = api.get("has_parking")
     self.assertFalse(has_parking)
예제 #25
0
 def test_min_sqft_7(self):
     api = parse("List apartments with at greater than 1,000 ft")
     self.assertEqual(api['min_sqft'], '1000')
예제 #26
0
 def testHasParkingIndirectlyStated(self):
     api = parse("Show me all apartments in Richmond, Virginia that have a parking garage")
     has_parking = api.get("has_parking")
     self.assertTrue(has_parking)
예제 #27
0
 def test_min_sqft_8(self):
     api = parse("Show me all apartments that are at least 50,000 sqft and under 60,000 sqft")
     self.assertEqual(api['min_sqft'], '50000')
예제 #28
0
 def testIsNotFurnished(self):
     api = parse("Show me all buildings in Richmond, Virginia that are not furnished")
     is_furnished = api.get("is_furnished")
     self.assertFalse(is_furnished)
예제 #29
0
 def testIsFurnishedIndirectlyStated(self):
     api = parse("Show me all apartments in Richmond, Virginia that already have furniture")
     is_furnished = api.get("is_furnished")
     self.assertTrue(is_furnished)
예제 #30
0
 def testDoesNotHaveFitnessCenter(self):
     api = parse("Show me all buildings in Richmond, Virginia that do not have a fitness center nearby")
     has_fitness_center = api.get('has_fitness_center')
     self.assertFalse(has_fitness_center)