diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 41a7cd6..d6b5045 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,12 +6,12 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ '3.6', '3.7', '3.8', '3.9', '3.10' ] + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/README.md b/README.md index 40a4ba9..07f13d1 100644 --- a/README.md +++ b/README.md @@ -130,3 +130,4 @@ transaction.commit() * [William Li](https://github.com/wli) * [Ugo Marchand](https://github.com/UgoM) * [Bryce Thornton](https://github.com/brycethornton) + diff --git a/mockfirestore/collection.py b/mockfirestore/collection.py index 431c074..da1de8a 100644 --- a/mockfirestore/collection.py +++ b/mockfirestore/collection.py @@ -13,6 +13,9 @@ def __init__(self, data: Store, path: List[str], self._data = data self._path = path self.parent = parent + self.id = None + if len(path): + self.id = path[0] def document(self, document_id: Optional[str] = None) -> DocumentReference: collection = get_by_path(self._data, self._path) @@ -80,6 +83,6 @@ def list_documents(self, page_size: Optional[int] = None) -> Sequence[DocumentRe return docs def stream(self, transaction=None) -> Iterable[DocumentSnapshot]: - for key in sorted(get_by_path(self._data, self._path)): + for key in sorted({str(k):v for k,v in get_by_path(self._data, self._path).items()}): doc_snapshot = self.document(key).get() yield doc_snapshot