Skip to content

Commit 1b4fb1a

Browse files
authored
Merge pull request #177 from datajoint/patch-176
Patch #176
2 parents fc87fa6 + 07244c3 commit 1b4fb1a

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

pharus/interface.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,11 @@ def _fetch_records(
176176
# Loop through each attributes, append to the tuple_to_return with specific
177177
# modification based on data type
178178
for attribute_name, attribute_info in attributes.items():
179-
if attribute_info.is_external:
180-
# Attribute is external type (filepath or attach),
181-
# thus fill it in string instead
182-
(
183-
row.append(non_blobs_row[attribute_name])
184-
if fetch_blobs
185-
else row.append("=FILE=")
186-
)
187-
elif not attribute_info.is_blob:
179+
if not (
180+
attribute_info.is_blob
181+
or attribute_info.is_attachment
182+
or attribute_info.is_filepath
183+
):
188184
if non_blobs_row[attribute_name] is None:
189185
# If it is none then just append None
190186
row.append(None)

tests/test_attributes.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,16 @@ def validate(table, inserted_value, expected_type, expected_value, client, token
4545
),
4646
)
4747
assert REST_response.status_code == 200
48-
REST_records = client.get(
48+
resp = client.get(
4949
f"/schema/{table.database}/table/{table.__name__}/record",
5050
headers=dict(Authorization=f"Bearer {token}"),
51-
).json["records"]
51+
)
52+
assert resp.status_code == 200, f"Failed to get records: {resp.text=}"
53+
assert (
54+
resp.json is not None
55+
), f"resp.json is None: {resp=} {dir(resp)=} {resp.text=}"
56+
assert "records" in resp.json, f"No records in response: {resp.json=}"
57+
REST_records = resp.json["records"]
5258
assert len(REST_records) == 1
5359
assert (
5460
isinstance(REST_records[0][1], expected_type)

0 commit comments

Comments
 (0)