Skip to content

Commit e2c433f

Browse files
committed
Fix get_triples and add test for it
1 parent 32f0cc2 commit e2c433f

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

terminusdb_client/client/Client.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -788,10 +788,6 @@ def get_triples(self, graph_type: str) -> str:
788788
-------
789789
str
790790
"""
791-
792-
### TODO: make triples works again
793-
raise InterfaceError("get_triples is temporary not avaliable in this version")
794-
795791
self._check_connection()
796792
self._validate_graph_type(graph_type)
797793
result = requests.get(

terminusdb_client/tests/integration_tests/test_client.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,23 @@ def test_log(docker_url):
166166
assert log[0]['@type'] == 'InitialCommit'
167167

168168

169+
def test_get_triples(docker_url):
170+
client = Client(docker_url, user_agent=test_user_agent, team="admin")
171+
client.connect()
172+
db_name = "testDB" + str(random())
173+
client.create_database(db_name, team="admin")
174+
client.connect(db=db_name)
175+
# Add a philosopher schema
176+
schema = {"@type": "Class",
177+
"@id": "Philosopher",
178+
"name": "xsd:string"
179+
}
180+
# Add schema and Socrates
181+
client.insert_document(schema, graph_type="schema")
182+
schema_triples = client.get_triples(graph_type='schema')
183+
assert "<schema#Philosopher>\n a sys:Class ;\n <schema#name> xsd:string ." in schema_triples
184+
185+
169186
def test_get_database(docker_url):
170187
client = Client(docker_url, user_agent=test_user_agent, team="admin")
171188
client.connect()

0 commit comments

Comments
 (0)