How to use the py2neo.cypher.cypher_repr function in py2neo

To help you get started, we’ve selected a few py2neo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github technige / py2neo / test / test_cypher_encoder.py View on Github external
def test_should_encode_positive_float(self):
        encoded = cypher_repr(123.456)
        assert encoded == u"123.456"
github technige / py2neo / test / test_cypher_encoder.py View on Github external
def test_should_encode_empty_list(self):
        encoded = cypher_repr([])
        assert encoded == u"[]"
github technige / py2neo / test / test_cypher_encoder.py View on Github external
def test_should_encode_negative_float(self):
        encoded = cypher_repr(-123.456)
        assert encoded == u"-123.456"
github technige / py2neo / test / test_cypher_encoder.py View on Github external
def test_should_encode_zero(self):
        encoded = cypher_repr(0)
        assert encoded == u"0"
github technige / py2neo / test / test_cypher_encoder.py View on Github external
def test_should_encode_8_byte_extended_character(self):
        encoded = cypher_repr(u"\U0010ABCD")
        assert encoded == u"'\\U0010abcd'"
github technige / py2neo / test / test_cypher_encoder.py View on Github external
def test_should_encode_node_with_label_and_property(self):
        a = Node("Person", name="Alice")
        encoded = cypher_repr(a)
        assert encoded == u"(:Person {name: 'Alice'})"
github technige / py2neo / test / test_cypher_encoder.py View on Github external
def test_can_write_path(self):
        alice, bob, carol, dave = Node(name="Alice"), Node(name="Bob"), \
                                  Node(name="Carol"), Node(name="Dave")
        path = Path(alice, "LOVES", bob, Relationship(carol, "HATES", bob), carol, "KNOWS", dave)
        encoded = cypher_repr(path)
        assert encoded == "(Alice)-[:LOVES {}]->(Bob)<-[:HATES {}]-(Carol)-[:KNOWS {}]->(Dave)"
github technige / py2neo / test / test_cypher_encoder.py View on Github external
def test_should_encode_true(self):
        encoded = cypher_repr(True)
        assert encoded == u"true"
github technige / py2neo / py2neo / cli / env.py View on Github external
def dump_separated_values(self, cursor, separator, header):
        if header:
            self.console.write_metadata(separator.join(cypher_repr(key, quote=u'"') for key in cursor.keys()))
        for record in cursor:
            self.console.write(separator.join(cypher_repr(value, quote=u'"') for value in record.values()))
github technige / py2neo / py2neo / data.py View on Github external
def write_value(value, **styles):
            if value is None:
                return
            if isinstance(value, string_types):
                value = ustr(value)
                if any(ch in value for ch in quotable):
                    value = quote + value.replace(quote, escaped_quote) + quote
            else:
                value = cypher_repr(value)
            secho(value, file, nl=False, **styles)