We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c517f07 commit 22b4de0Copy full SHA for 22b4de0
tests.py
@@ -5,6 +5,7 @@
5
from unittest import TestCase
6
7
from postgres import Postgres, TooFew, TooMany
8
+from postgres.orm import ReadOnly
9
from psycopg2.extras import RealDictCursor
10
from psycopg2 import InterfaceError, ProgrammingError
11
@@ -250,6 +251,12 @@ def test_updating_attributes_works(self):
250
251
bar = self.db.one("SELECT bar FROM foo WHERE bar='blah'")
252
assert bar == one.bar
253
254
+ def test_attributes_are_read_only(self):
255
+ one = self.db.one("SELECT foo.*::foo FROM foo WHERE bar='baz'")
256
+ def assign():
257
+ one.bar = "blah"
258
+ self.assertRaises(ReadOnly, assign)
259
+
260
261
# cursor_factory
262
# ==============
0 commit comments