Skip to content

Commit

Permalink
fix(tests): on python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
matfax committed Oct 24, 2019
1 parent e6ce623 commit 2c8358f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 39 deletions.
39 changes: 0 additions & 39 deletions tests/serializable.py

This file was deleted.

39 changes: 39 additions & 0 deletions tests/test_serializable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import sys
from dataclasses import dataclass

from mashumaro import DataClassDictMixin

from mutapath import Path
from tests.helper import PathTest

if sys.version_info == (3, 7):
@dataclass
class DataClass(DataClassDictMixin):
path: Path = Path()


class TestSerialization(PathTest):
def test_empty_serialization(self):
expected = {'path': ''}
actual = DataClass().to_dict()
self.assertEqual(expected, actual)

def test_serialization(self):
expected = {'path': "/A/B/test1.txt"}
actual = DataClass(Path("/A/B/test1.txt", posix=True)).to_dict()
self.assertEqual(expected, actual)

def test_empty_deserialization(self):
expected = DataClass()
actual = DataClass().from_dict({'path': ''})
self.assertEqual(expected, actual)

def test_deserialization(self):
expected = DataClass(Path("/A/B/test1.txt", posix=True))
actual = DataClass().from_dict({'path': "/A/B/test1.txt"})
self.assertEqual(expected, actual)

def test_deserialization_static(self):
expected = DataClass(Path("/A/B/test1.txt", posix=True))
actual = DataClass.from_dict({'path': "/A/B/test1.txt"})
self.assertEqual(expected, actual)

0 comments on commit 2c8358f

Please sign in to comment.