Exemple #1
0
 def test_friends_first_name(self):
     friends = xpath_json.extract('friends/#/firstName', self.input)
     first_names = ['Dale', 'Roger', 'Jane']
     self.assertListEqual(friends, first_names)
Exemple #2
0
 def test_fav_movie(self):
     fav_movie = xpath_json.extract('fav.movie', self.input)
     self.assertEqual(fav_movie, 'Mr & Mrs Smith')
Exemple #3
0
 def test_friends_age_lt_47(self):
     friends = xpath_json.extract('friends/#[age<47]/#', self.input)
     self.assertEqual(friends, 1)
Exemple #4
0
 def test_home_phone_number(self):
     phone_number = xpath_json.extract(
         'phoneNumbers/#[description==mobile]/0/number', self.input)
     self.assertEqual(phone_number, '678-555-1234')
Exemple #5
0
 def test_find_address_by_zipcode(self):
     addresses = xpath_json.extract('addresses/#[postalCode==30305]/#',
                                    self.input)
     self.assertEqual(addresses, 2)
Exemple #6
0
 def test_home_address(self):
     address = xpath_json.extract('addresses/#[description==home]',
                                  self.input)
     self.assertDictEqual(address[0], self.input['addresses'][0])
Exemple #7
0
 def test_count_addresses(self):
     count = xpath_json.extract('addresses/#', self.input)
     self.assertEqual(count, 2)
Exemple #8
0
 def test_spouse(self):
     spouse = xpath_json.extract('spouse/firstName', self.input)
     self.assertEqual(spouse, 'Mary')