Procházet zdrojové kódy

fix: fix error in the serialization of the Object type (#18)

tags/v0.11.1
Jérôme Deuchnord před 3 roky
committed by GitHub
rodič
revize
9ad4371032
V databázi nebyl nalezen žádný známý klíč pro tento podpis ID GPG klíče: 4AEE18F83AFDEB23
2 změnil soubory, kde provedl 25 přidání a 7 odebrání
  1. +18
    -6
      .github/workflows/tests.yml
  2. +7
    -1
      kosmorrolib/model.py

+ 18
- 6
.github/workflows/tests.yml Zobrazit soubor

@@ -31,21 +31,27 @@ jobs:
with:
python-version: ${{ matrix.python_version }}

- name: Prepare environment
- name: Prepare environment (non-Windows systems)
if: ${{ matrix.os != 'windows-2019' }}
run: |
pip install --upgrade pip pipenv

- name: Prepare environment (Windows)
if: ${{ matrix.os == 'windows-2019' }}
run: |
python -mpip install --upgrade pip pipenv

- name: Install dependencies (all systems)
run: |
pipenv lock --pre
pipenv sync --dev
pipenv install --dev

- name: Install dependencies (Windows-specific)
- name: Install dependencies (Windows)
if: ${{ matrix.os == 'windows-2019' }}
run: |
pipenv lock --dev -r > requirements.txt
pip install -r requirements.txt
python -mpip install -r requirements.txt

- name: Run legacy tests
run: |
@@ -75,21 +81,27 @@ jobs:
with:
python-version: ${{ matrix.python_version }}

- name: Prepare environment
- name: Prepare environment (non-Windows systems)
if: ${{ matrix.os != 'windows-2019' }}
run: |
pip install --upgrade pip pipenv

- name: Prepare environment (Windows)
if: ${{ matrix.os == 'windows-2019' }}
run: |
python -mpip install --upgrade pip pipenv

- name: Install dependencies (all systems)
run: |
pipenv lock --pre
pipenv sync --dev
pipenv install --dev

- name: Install dependencies (Windows-specific)
- name: Install dependencies (Windows)
if: ${{ matrix.os == 'windows-2019' }}
run: |
pipenv lock -r > requirements.txt
pip install -r requirements.txt
python -mpip install -r requirements.txt

- name: Run doc tests (with coverage)
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.python_version == '3.9' }}


+ 7
- 1
kosmorrolib/model.py Zobrazit soubor

@@ -114,9 +114,15 @@ class Object(Serializable):
)

def serialize(self) -> dict:
"""Serialize the given object

>>> planet = Planet(ObjectIdentifier.MARS, "MARS")
>>> planet.serialize()
{'identifier': 'MARS', 'type': 'PLANET', 'radius': None}
"""
return {
"identifier": self.identifier.name,
"type": self.get_type(),
"type": self.get_type().name,
"radius": self.radius,
}



Načítá se…
Zrušit
Uložit