-
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #301 from vnetserg/master
Fix shadowed namedtuple bug
- Loading branch information
Showing
4 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This package is used by the `test_shadowed_namedtuple` test. | ||
# Author: Sergei Fomin (se4min at yandex-team.ru) | ||
|
||
from .shadowed import shadowed | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This module is used by the `test_shadowed_namedtuple` test. | ||
# Author: Sergei Fomin (se4min at yandex-team.ru) | ||
|
||
from collections import namedtuple | ||
|
||
class Shadowed(namedtuple("Shadowed", [])): | ||
pass | ||
|
||
def shadowed(): | ||
return Shadowed() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env python | ||
# | ||
# Author: Sergei Fomin (se4min at yandex-team.ru) | ||
|
||
from dill import dumps, loads | ||
from shadowed_namedtuple import shadowed | ||
|
||
def test_shadowed_namedtuple(): | ||
obj = shadowed() | ||
obj_loaded = loads(dumps(obj)) | ||
assert obj.__class__ is obj_loaded.__class__ | ||
|
||
if __name__ == "__main__": | ||
test_shadowed_namedtuple() | ||
|