]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Fix random test failure caused by degenerate list sample
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 11 Oct 2021 15:35:44 +0000 (17:35 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 11 Oct 2021 15:37:22 +0000 (17:37 +0200)
For example it would fail if a list containing an empty range would be
selected.

https://github.com/psycopg/psycopg/pull/102/checks?check_run_id=3859021392

tests/fix_faker.py

index 63c933e7338631177d7adb0508e1c59a10f9ed12..fe1c55dc1ac7a69e6038bf826423d6af4a989d51 100644 (file)
@@ -506,6 +506,9 @@ class Faker:
         spec = spec[1]
         return [self.make(spec) for i in range(length)]
 
+    def example_list(self, spec):
+        return [self.example(spec[1])]
+
     def match_list(self, spec, got, want):
         assert len(got) == len(want)
         m = self.get_matcher(spec[1])