diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2021-05-19 17:42:17 +0100 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2021-05-19 17:42:25 +0100 |
commit | f07fd91889749bec2b7a5fce3af4f10b3e2b3f73 (patch) | |
tree | fc639089aec8c6a4a24889053f7ef1ad7915af46 | |
parent | 2ed09e9b628ec32131e981d467591d20acd1455d (diff) |
updated repr() for Master associated with a month
-rw-r--r-- | CHANGELOG.md | 5 | ||||
-rw-r--r-- | datamaps/__init__.py | 2 | ||||
-rw-r--r-- | datamaps/plugins/dft/master.py | 5 | ||||
-rw-r--r-- | datamaps/tests/test_api.py | 7 | ||||
-rw-r--r-- | pyproject.toml | 2 |
5 files changed, 18 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index ad1a09a..fef7801 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## v1.1.7 + +* Updated `repr()` for `Master` object to account for it relating to a + month or a quarter. + ## v1.1.6 * Added the `Month()` object to `datamaps.api`. You can now assign a month diff --git a/datamaps/__init__.py b/datamaps/__init__.py index 1436d8f..bf78826 100644 --- a/datamaps/__init__.py +++ b/datamaps/__init__.py @@ -1 +1 @@ -__version__ = "1.1.6" +__version__ = "1.1.7" diff --git a/datamaps/plugins/dft/master.py b/datamaps/plugins/dft/master.py index 324b63d..edd79ee 100644 --- a/datamaps/plugins/dft/master.py +++ b/datamaps/plugins/dft/master.py @@ -272,4 +272,7 @@ class Master: return False def __repr__(self): - return f"Master({self.path}, {self.quarter.quarter}, {self.quarter.year})" + if self._declared_month: + return f"Master for {self.month} - {self.month.year}({self.path}, {self.quarter.quarter}, {self.quarter.year})" + else: + return f"Master({self.path}, {self.quarter.quarter}, {self.quarter.year})" diff --git a/datamaps/tests/test_api.py b/datamaps/tests/test_api.py index 295f1fb..04a6805 100644 --- a/datamaps/tests/test_api.py +++ b/datamaps/tests/test_api.py @@ -19,6 +19,13 @@ def test_get_project_data_using_month(master): m3 = project_data_from_master_month(master, 9, 2021) m4 = project_data_from_master_month(master, 10, 2021) m5 = project_data_from_master_month(master, 2, 2021) # this is q4 + m6 = project_data_from_master_month(master, 5, 2030) # this is q4 + assert "Master for Month(July) - 2021" in repr(m) + assert "Master for Month(August) - 2021" in repr(m2) + assert "Master for Month(September) - 2021" in repr(m3) + assert "Master for Month(October) - 2021" in repr(m4) + assert "Master for Month(February) - 2021" in repr(m5) + assert "Master for Month(May) - 2030" in repr(m6) assert m["Chutney Bridge.xlsm"]["Project/Programme Name"] == "Chutney Bridge Ltd" assert isinstance(m.month, Month) assert m.month.name == "July" diff --git a/pyproject.toml b/pyproject.toml index 87d347a..66bd5d8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools", "wheel"] [tool.poetry] name = "datamaps" -version = "1.1.6" +version = "1.1.7" homepage = "https://github.com/hammerheadlemon/datamaps" repository = "https://github.com/hammerheadlemon/datamaps" license = "MIT" |