Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown forces an empty line at the end #54

Closed
hynek opened this issue Jul 13, 2023 · 9 comments
Closed

Markdown forces an empty line at the end #54

hynek opened this issue Jul 13, 2023 · 9 comments
Assignees

Comments

@hynek
Copy link

hynek commented Jul 13, 2023

Hi, I've finally come around to try it!

Looks promising, but the following doesn't work:

```python
>>> import svc_reg
>>> import uuid

>>> reg = svc_reg.Registry()

>>> reg.register_factory(uuid.UUID, uuid.uuid4)
>>> reg.register_value(str, "Hello World")
```

Gives me:

Example at /Users/hynek/FOSS/svc-reg/README.md, line 41, column 1 did not evaluate as expected:
Expected:
   ```
Got nothing

README.md:41: SybilFailure

While the following does (empty last line):

```python
>>> import svc_reg
>>> import uuid

>>> reg = svc_reg.Registry()

>>> reg.register_factory(uuid.UUID, uuid.uuid4)
>>> reg.register_value(str, "Hello World")

```

This is not just about None results.

```python
>>> container = svc_reg.Container(reg)

>>> u = container.get(uuid.UUID)
>>> u
UUID('...')
>>> # Calling get() again returns the SAME UUID instance!
>>> # Good for DB connections, bad for UUIDs.
>>> u is container.get(uuid.UUID)
True
>>> container.get(str)
'Hello World'
```

gives me:

Example at /Users/hynek/FOSS/svc-reg/README.md, line 62, column 1 did not evaluate as expected:
Expected:
    'Hello World'
    ```
Got:
    'Hello World'

README.md:62: SybilFailure
@cjw296
Copy link
Member

cjw296 commented Jul 13, 2023

Hmm, smells like another version of #52.
Parsing is hard 😭

@cjw296
Copy link
Member

cjw296 commented Jul 13, 2023

Can you share your sybil setup from conftest.py?

@cjw296 cjw296 self-assigned this Jul 13, 2023
@hynek
Copy link
Author

hynek commented Jul 13, 2023

@cjw296
Copy link
Member

cjw296 commented Jul 13, 2023

How come you're using the ReST parsers rather than sybil.parsers.myst.PythonCodeBlockParser?

@cjw296
Copy link
Member

cjw296 commented Jul 13, 2023

Added a couple of tests which appear to show this working:
ed027e8

Also chucked in a PR to what I hope will fix things up:
hynek/svcs#2

@hynek
Copy link
Author

hynek commented Jul 13, 2023

How come you're using the ReST parsers rather than sybil.parsers.myst.PythonCodeBlockParser?

the answer is, as always: copy and paste :D

@cjw296
Copy link
Member

cjw296 commented Jul 14, 2023

But from where?

@hynek
Copy link
Author

hynek commented Jul 15, 2023

I think maybe https://sybil.readthedocs.io/en/latest/patterns.html – I was a bit in a panic mode doing three things at once after fighting my own stuff for a whole day.

@cjw296
Copy link
Member

cjw296 commented Jul 16, 2023

Okay, let's move this over to hynek/svcs#2, if there are bugs, we can re-open this one, or others

@cjw296 cjw296 closed this as completed Jul 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants