text: import decimal
  import pathlib
  import pytest
  from typing import List, Tuple
  
  from tests import tests_dir, build_test_case_from_fixture_dir
  from brokerparse import common
  
  
  fixtures_dir = tests_dir / "fixtures" / "common"
  
  
  @pytest.fixture(scope="session", params=list(fixtures_dir.glob("*.qfx")))
  def ofx_test_case(request):
      ofx_path = request.param  # type: pathlib.Path
      return build_test_case_from_fixture_dir(ofx_path, open_mode="rb")
  
  
  class TestOfxParse(object):
      def test_parse(self, ofx_test_case: Tuple[str, List[common.Holding]]):
          ofx_content, expectations = ofx_test_case
  
          holdings = common.parse_ofx(ofx_content)
  
          assert len(holdings) == len(expectations)
  
          for holding, expectation in zip(holdings, expectations):
              assert holding.account == expectation.account
              assert holding.symbol == expectation.symbol
              assert holding.verbose_name == expectation.verbose_name
  
              # Vanguard exports are often a couple of cents off
              assert (
                  expectation.dollar_value - decimal.Decimal(0.021)
                  <= holding.dollar_value
                  <= expectation.dollar_value + decimal.Decimal(0.021)
              )
  