示例#1
0
    def __init__(self, data):
        """ Initialize and store data to be validated.

        :param data: JSON-formatted object or string

        """
        # Ensure that input is JSON
        self.data = jsontools.to_json(data)
示例#2
0
    def __init__(self, data):
        """ Initialize and store data to be validated.

        Args:
            data : JSON-formatted object or JSON-formatted string

        """
        self.data = jsontools.to_json(data)
示例#3
0
async def refresh_fixtures(hole_dir: HoleDirection, n: int = 10):

    fixture_path = Path("tests/fixtures")
    hd = hole_dir.value.lower()

    if hole_dir == HoleDirection.H:
        wellpath = IHSPath.well_h_sample
        prodpath = IHSPath.prod_h
        prodheaderpath = IHSPath.prod_h_headers
        geompath = IHSPath.well_h_geoms

    elif HoleDirection.V:
        wellpath = IHSPath.well_v_sample
        prodpath = IHSPath.prod_v
        prodheaderpath = IHSPath.prod_v_headers
        geompath = IHSPath.well_v_geoms
    else:
        raise ValueError("invalid hole direction")

    wells = await IHSClient.get_sample(wellpath, n=n, area="tx-midland")
    api14s = [x["api14"] for x in wells]

    to_json(wells, fixture_path / f"wells_{hd}.json")

    prod = await IHSClient.get_production(prodpath, api14s=api14s)
    to_json(
        prod, fixture_path / f"prod_{hd}.json",
    )

    prod_headers = await IHSClient.get_production(prodheaderpath, api14s=api14s)
    to_json(
        prod_headers, fixture_path / f"prod_headers_{hd}.json",
    )

    geoms = await IHSClient.get_wells(geompath, api14s=api14s)
    to_json(
        geoms, fixture_path / f"geoms_{hd}.json",
    )

    fracs = await FracFocusClient.get_jobs(api14s=api14s)
    to_json(
        fracs, fixture_path / f"fracs_{hd}.json",
    )
示例#4
0
 def test_json_file(self, tmpdir):
     path = tmpdir.mkdir("test").join("test.json")
     data = {"key": "value"}
     to_json(data, path)
     loaded = load_json(path)
     assert data == loaded
示例#5
0
 def __init__(self, data):
     """ Initialize and store data. """
     self.source = jsontools.to_json(data)