make format

delete unused imports
This commit is contained in:
Suhas 2021-05-06 15:12:48 -04:00 committed by MinchinWeb
parent c76b9788e6
commit 788b32b71c
6 changed files with 26 additions and 14 deletions

View file

@ -461,6 +461,7 @@ def run(context, command, text=""):
@given('we load template "{filename}"')
def load_template(context, filename):
full_path = os.path.join("features/data/templates", filename)
exporter = plugins.template_exporter.__exporter_from_file(full_path)
plugins.meta.__exporter_types[exporter.names[0]] = exporter

View file

@ -12,7 +12,6 @@ import os
import re
import unicodedata
from jrnl import __version__
from jrnl.color import ERROR_COLOR
from jrnl.color import RESET_COLOR

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python
# encoding: utf-8
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
@ -7,9 +7,9 @@
Exporter for testing and experimentation purposes
"""
from jrnl import __version__
from jrnl.plugins.base import BaseExporter
class Exporter(BaseExporter):
names=["testing","test"]
version= 'v0.0.1'
names = ["testing", "test"]
version = "v0.0.1"

View file

@ -3,7 +3,6 @@
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
from jrnl import __version__
from jrnl.plugins.base import BaseExporter
from ... import __version__

View file

@ -3,6 +3,7 @@
# Copyright (C) 2012-2021 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
def get_tags_count(journal):
"""Returns a set of tuples (count, tag) for all tags present in the journal."""
# Astute reader: should the following line leave you as puzzled as me the first time

View file

@ -5,23 +5,35 @@ from jrnl import Entry, Journal
from datetime import date
import json
@pytest.fixture()
def create_entry():
entry = Entry.Entry(journal=Journal.Journal(),text="This is the entry text", date=date(year=2001,month=1,day=1),starred=True)
entry = Entry.Entry(
journal=Journal.Journal(),
text="This is the entry text",
date=date(year=2001, month=1, day=1),
starred=True,
)
yield entry
class TestBaseExporter(testing_exporter.Exporter):
def test_unimplemented_export(self, create_entry):
class TestBaseExporter(testing_exporter.Exporter):
def test_unimplemented_export(self, create_entry):
entry = create_entry
with pytest.raises(NotImplementedError):
self.export_entry(entry)
class TestJsonExporter(json_exporter.Exporter):
def test_json_exporter_name(self):
class TestJsonExporter(json_exporter.Exporter):
def test_json_exporter_name(self):
assert "json" in self.names
def test_export_entry(self,create_entry):
def test_export_entry(self, create_entry):
entry = create_entry
fake_uuid = "ewqf09-432p9p0433-243209" # generated by mashing keys
entry.uuid = fake_uuid
exported = self.export_entry(entry)
deserialized_export = json.loads(exported)
assert deserialized_export['title'] == "This is the entry text"
assert deserialized_export['date'] == '2001-01-01'
assert deserialized_export["title"] == "This is the entry text"
assert deserialized_export["date"] == "2001-01-01"
assert "uuid" in deserialized_export.keys()