# -*- coding: utf-8 -*-

import logging
import re
import sys

import pytest

import cloudpickle
import six

from google.protobuf import json_format

import verta
from verta.environment import (
    Python,
)
from verta._internal_utils._pip_requirements_utils import (
    SPACY_MODEL_PATTERN,
    get_pip_freeze,
    pin_verta_and_cloudpickle,
)


def assert_parsed_reqs_match(parsed_reqs, original_reqs):
    """Assert that requirements match as expected

    ``pip freeze`` can return ``black==21.6b0`` while our parsing yields
    ``black==21.6.0b0``, though these are equivalent.

    Parameters
    ----------
    parsed_reqs : list of str
        e.g. ``Python.requirements``
    original_reqs : list of str
        e.g. ``Python.read_pip_environment()``

    """
    parsed_reqs = set(parsed_reqs)
    original_reqs = set(original_reqs)

    parsed_mapping = {
        req.split("==")[0]: Python._req_spec_to_msg(req)
        for req in parsed_reqs
    }
    original_mapping = {
        req.split("==")[0]: Python._req_spec_to_msg(req)
        for req in original_reqs
    }

    assert parsed_mapping == original_mapping


class TestObject:
    def test_repr(self):