title: How to use Pytest to assert multiple values
body: <p>I'm new to pytest and unit tests. How to use assert with multiple values?
  My function <code>get_private_subnet_ids():</code> returns multiple subnets in the form of a list. And my test function <code>test_sharing_private_subnets_exist(accountid)</code> should do an assert to check if they contain these subnets</p>
  <p>How do I extract individual element of the list <code>private_subnet_ids</code> and compare each element with my defined <code>expected_subnets</code> list in test function?</p>
  <p>I would like to have table-driven testing. I have a list to store all the test cases.
  Below is the function that returns multiple subnets from AWS VPC matching the Tag <code>my-private</code></p>
  <pre><code>def get_private_subnet_ids():
      private_subnet_ids = []
      vpc_client = aws_assumed_session_client(account_id=accountid, aws_service='ec2')
      subnets = vpc_client.describe_subnets()
      for subnet in subnets['Subnets']:
          if 'Tags' in subnet:
              for tag in subnet['Tags']:
                  if tag['Key'] == 'Name' and tag['Value'].startswith('my-private'):
                      private_subnet_ids = subnet['SubnetId']
                      print(&quot;[DEBUG]Queried Public Subnet ID's: {}&quot;.format(private_subnet_ids))
      return private_subnet_ids
  </code></pre>
  <p>I want to have a test function like this using table driven testing, that tests if the subnets exist as defined in the <code>expected_subnets</code> list/table</p>
  <pre><code>def test_sharing_subnets _exist(account_id):
  &quot;&quot;&quot; Tests to verify if Subnets exist in target account. This is example of table driven tests &quot;&quot;&quot;
  # subnets = [&quot;my-private-1&quot;, &quot;my-private-2&quot;, &quot;my-private-3&quot;]
  expected_subnets = [ &quot;subnet-0b6aaaf1ce07xx03&quot;, &quot;subnet-0e54fda8f811fxxd8&quot;,&quot; subnet-08f6d70b65a5cxx38&quot;]
  for subnet in expected_subnets:
      assert get_private_subnet_ids(subnet), &quot;Subnet {} does not exist&quot;.format(subnet)
  </code></pre>
  <p>I run my pytest like this with the --accountids</p>
  <pre><code>pytest test_vpc_subnets.py --accountids 75381674129 
  </code></pre>
  <p>Assertion Error</p>
  <pre><code>  AssertionError
  -------------------------------------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------------------------------------
  [DEBUG]Queried Private Subnet ID's: subnet-08f6d70b65a5cxx38
  [DEBUG]Queried PrivateSubnet ID's: subnet-0b6aaaf1ce07xx03
  [DEBUG]Queried Private Subnet ID's: subnet-0e54fda8f811fxxd8
  ======================================================================================================= short test summary info =======================================================================================================
  FAILED test_vpc_subnets.py::test_sharing_subnets_exist[753816747583-subnet-08f6d70b65a5cxx38] - AssertionError: assert 'subnet-08f6d70b65a5cxx38' in 'subnet-0e54fda8f811fxxd8'
  FAILED test_vpc_subnets.py::test_sharing_subnets_exist[753816747583-subnet-0b6aaaf1ce07xx03] - AssertionError: assert 'subnet-0b6aaaf1ce07xx03' in ' subnet-0e54fda8f811fxxd8'
  </code></pre>