Skip to content

Commit

Permalink
fixes #197
Browse files Browse the repository at this point in the history
  • Loading branch information
jph00 committed Nov 13, 2020
1 parent 7f909e2 commit bc3b84f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fastcore/basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def basic_repr(flds=None):
if isinstance(flds, str): flds = re.split(', *', flds)
flds = list(flds or [])
def _f(self):
sig = ', '.join(f'{o}={maybe_attr(getattr(self,o), "__name__")}' for o in flds)
sig = ', '.join(f'{o}={getattr(self,o)!r}' for o in flds)
return f'{self.__class__.__name__}({sig})'
return _f

Expand Down
6 changes: 3 additions & 3 deletions nbs/01_basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
" if isinstance(flds, str): flds = re.split(', *', flds)\n",
" flds = list(flds or [])\n",
" def _f(self):\n",
" sig = ', '.join(f'{o}={maybe_attr(getattr(self,o), \"__name__\")}' for o in flds)\n",
" sig = ', '.join(f'{o}={getattr(self,o)!r}' for o in flds)\n",
" return f'{self.__class__.__name__}({sig})'\n",
" return _f"
]
Expand Down Expand Up @@ -159,8 +159,8 @@
"sc = SomeClass() \n",
"ac = AnotherClass()\n",
"\n",
"test_eq(repr(sc), 'SomeClass(a=1, b=foo)')\n",
"test_eq(repr(ac), 'AnotherClass(c=some-class, d=bar)')"
"test_eq(repr(sc), \"SomeClass(a=1, b='foo')\")\n",
"test_eq(repr(ac), \"AnotherClass(c=SomeClass(a=1, b='foo'), d='bar')\")"
]
},
{
Expand Down

0 comments on commit bc3b84f

Please sign in to comment.