diff options
author | BonfaceKilz | 2020-09-28 18:13:19 +0300 |
---|---|---|
committer | BonfaceKilz | 2020-09-28 18:13:19 +0300 |
commit | da6098574f8b410386e84f07fd0e8d0eed39e40d (patch) | |
tree | 5da9a54c80ea4525aa2fb08f9dc3012c99626ed9 /wqflask/tests/base/test_trait.py | |
parent | d34258bed3ef13350499414100401df3bf08a105 (diff) | |
parent | 367de7d8bd822a80cdc035a219b814f0b268b65f (diff) | |
download | genenetwork2-da6098574f8b410386e84f07fd0e8d0eed39e40d.tar.gz |
Merge branch 'build/python3-migration' of github.com:BonfaceKilz/genenetwork2 into build/python3-migration
Diffstat (limited to 'wqflask/tests/base/test_trait.py')
-rw-r--r-- | wqflask/tests/base/test_trait.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/wqflask/tests/base/test_trait.py b/wqflask/tests/base/test_trait.py index 1a3820f2..60ebaee0 100644 --- a/wqflask/tests/base/test_trait.py +++ b/wqflask/tests/base/test_trait.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Tests wqflask/base/trait.py""" import unittest -import mock +from unittest import mock from base.trait import GeneralTrait from base.trait import retrieve_trait_info @@ -38,9 +38,8 @@ class TestRetrieveTraitInfo(unittest.TestCase): dataset={}) @mock.patch('base.trait.requests.get') - @mock.patch('base.trait.g') + @mock.patch('base.trait.g', mock.Mock()) def test_retrieve_trait_info_with_empty_trait_info(self, - g_mock, requests_mock): """Empty trait info""" requests_mock.return_value = TestNilResponse() @@ -49,9 +48,8 @@ class TestRetrieveTraitInfo(unittest.TestCase): dataset=mock.MagicMock()) @mock.patch('base.trait.requests.get') - @mock.patch('base.trait.g') + @mock.patch('base.trait.g', mock.Mock()) def test_retrieve_trait_info_with_non_empty_trait_info(self, - g_mock, requests_mock): """Test that attributes are set""" mock_dataset = mock.MagicMock() @@ -66,9 +64,8 @@ class TestRetrieveTraitInfo(unittest.TestCase): self.assertEqual(test_trait.d, 4) @mock.patch('base.trait.requests.get') - @mock.patch('base.trait.g') + @mock.patch('base.trait.g', mock.Mock()) def test_retrieve_trait_info_utf8_parsing(self, - g_mock, requests_mock): """Test that utf-8 strings are parsed correctly""" utf_8_string = "test_string" @@ -96,9 +93,9 @@ class TestRetrieveTraitInfo(unittest.TestCase): test_trait = retrieve_trait_info(trait=mock_trait, dataset=mock_dataset) self.assertEqual(test_trait.abbreviation, - "ファイルを画面毎に見て行くには、次のコマンドを使います。".decode('utf-8')) + "ファイルを画面毎に見て行くには、次のコマンドを使います。") self.assertEqual(test_trait.authors, - "Jane Doe かいと".decode('utf-8')) + "Jane Doe かいと") @mock.patch('base.trait.requests.get') @mock.patch('base.trait.g') |