Code Monkey home page Code Monkey logo

Comments (4)

max-sixty avatar max-sixty commented on June 12, 2024

Thanks @aaronspring . I'll have a look.

One thing I've found works for these is to use r""" for docstrings. Let me see whether that works in this case. Either way, this should be a nicer experience than it currently is

from pytest-accept.

max-sixty avatar max-sixty commented on June 12, 2024

FWIW this does fix the immediate problem:

diff --git a/examples/escapes.py b/examples/escapes.py
index 97f7d2f..17f8b9d 100644
--- a/examples/escapes.py
+++ b/examples/escapes.py
@@ -1,5 +1,5 @@
 def func(a, b):
-    """
+    r"""
     Example:
     >>> import xarray as xr
     >>> func(xr.DataArray([5], dims='a'), xr.DataArray([1], dims='a'))

We could at least check for the r / insert an r.

But would you actually prefer that the \n are newlines rather than \n characters? I could imagine that's clearer.

I'm guessing this behavior is something to do with how we print the repr in xarray, since normally printing \n does give us an actual new line:

    >>> print("testing\ntesting")
    testing
    testing

Edit: it's that the arrays are atrs so that part is up to xarray, and xarray is probably doing the correct thing for reprs within attrs

from pytest-accept.

aaronspring avatar aaronspring commented on June 12, 2024

thanks for the r"""doc strings""" that works

from pytest-accept.

aaronspring avatar aaronspring commented on June 12, 2024

But would you actually prefer that the \n are newlines rather than \n characters? I could imagine that's clearer.

I dont have an opinion

from pytest-accept.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.