Skip to content

Commit

Permalink
Merge pull request #51 from nodestream-proj/test/additional-integrati…
Browse files Browse the repository at this point in the history
…on-tests
  • Loading branch information
zprobst authored Aug 22, 2023
2 parents 0ee9ca8 + 05daf54 commit ea1fffd
Show file tree
Hide file tree
Showing 10 changed files with 104,282 additions and 4 deletions.
6 changes: 3 additions & 3 deletions nodestream/cli/operations/print_project_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Optional

from ...project import Project
from ...schema.printers import SCHEMA_PRINTER_SUBCLASS_REGISTRY, SchemaPrinter
from ...schema.printers import SchemaPrinter
from ..commands.nodestream_command import NodestreamCommand
from .operation import Operation

Expand All @@ -25,10 +25,10 @@ async def perform(self, command: NodestreamCommand):
Path(self.type_overrides_file) if self.type_overrides_file else None
)
schema = self.project.get_schema(type_overrides_file=type_overrides_file)

# Import all schema printers so that they can register themselves
SchemaPrinter.import_all()
printer_cls = SCHEMA_PRINTER_SUBCLASS_REGISTRY.get(self.format_string)
printer = printer_cls()
printer = SchemaPrinter.from_name(self.format_string)
if self.output_file:
printer.print_schema_to_file(schema, Path(self.output_file))
else:
Expand Down
4 changes: 4 additions & 0 deletions nodestream/schema/printers/schema_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ def print_schema_to_stdout(self, schema: GraphSchema, print_fn=print):

def print_schema_to_string(self, schema: GraphSchema) -> str:
return str(schema)

@classmethod
def from_name(cls, name: str) -> "SchemaPrinter":
return SCHEMA_PRINTER_SUBCLASS_REGISTRY.get(name)()
1,001 changes: 1,001 additions & 0 deletions tests/integration/fixtures/data/airport-codes.csv

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions tests/integration/fixtures/pipelines/airports.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
- implementation: nodestream.pipeline.extractors:FileExtractor
arguments:
globs:
- tests/integration/fixtures/data/airport-codes.csv

- implementation: nodestream.interpreting:Interpreter
arguments:
interpretations:
- type: source_node
node_type: Airport
key:
identifier: !jmespath ident
properties:
elevation_in_feet: !jmespath elevation_ft
iata_code: !jmespath iata_code
local_code: !jmespath local_code
name: !jmespath name
- type: relationship
node_type: Country
relationship_type: WITHIN
node_key:
code: !jmespath iso_country
- type: relationship
node_type: Region
relationship_type: WITHIN
node_key:
code: !jmespath iso_region
Loading

0 comments on commit ea1fffd

Please sign in to comment.