Exemple #1
0
    def test_raises_on_incorrect_input_type(self):
        """
        Assert that `to_uuid` raises error on wrong input class
        """
        with pytest.raises(TypeError) as exc:
            to_uuid(3.0)

        assert "Cannot convert object to UUID" in str(exc)
        assert "float" in str(exc)
Exemple #2
0
    def stream_from_uuid(self, uuid):
        """
        Creates a stream handle to the BTrDB stream with the UUID `uuid`. This
        method does not check whether a stream with the specified UUID exists.
        It is always good form to check whether the stream existed using
        `stream.exists()`.


        Parameters
        ----------
        uuid: UUID
            The uuid of the requested stream.

        Returns
        -------
        Stream
            instance of Stream class or None

        """
        return Stream(self, to_uuid(uuid))
Exemple #3
0
 def test_raises_on_bad_data(self):
     """
     Assert that `to_uuid` raises error with bad UUID string
     """
     with pytest.raises(ValueError):
         to_uuid("bad data!!!")
Exemple #4
0
 def test_from_uuid(self):
     """
     Assert that `to_uuid` returns passed UUID
     """
     assert to_uuid(EXAMPLE_UUID) == EXAMPLE_UUID
Exemple #5
0
 def test_from_str(self):
     """
     Assert that `to_uuid` converts from str
     """
     assert to_uuid(EXAMPLE_UUID_STR) == EXAMPLE_UUID
Exemple #6
0
 def test_from_bytes(self):
     """
     Assert that `to_uuid` converts from bytes
     """
     assert to_uuid(EXAMPLE_UUID_BYTES) == EXAMPLE_UUID