From ce8d0fc4797ea0a26f7562afbddedccdd2aae7a4 Mon Sep 17 00:00:00 2001 From: Kirsty McCready Date: Wed, 6 Mar 2024 13:37:14 +0000 Subject: [PATCH 1/5] Ignoring virtual env. folder --- .gitignore | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4e7d8d8..7530e6e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,19 @@ -venv/ - +# IDEs +.vscode/ .idea/ +# Intermediate Coverage file +.coverage + +# Output files +*.png + +# Python runtime +*.pyc +*.egg-info +.pytest_cache __pycache__/ + +# Virtual environments +venv/ +.venv/ From 2e873e1c0a34fb71e303aab1b9752f6523383c67 Mon Sep 17 00:00:00 2001 From: Kirsty McCready Date: Wed, 6 Mar 2024 13:44:28 +0000 Subject: [PATCH 2/5] personalised README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ad7043c..151f6ae 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Oxford RSE Unit Conversion +# Oxford RSE Unit Conversion - Kirsty McCready [![Unittest](https://github.com/OxfordRSE/oxrse_unit_conv/actions/workflows/unittest.yml/badge.svg)](https://github.com/OxfordRSE/oxrse_unit_conv/actions/workflows/unittest.yml) From 8e87caa8a76ab65e2dceb124a327591508c3efed Mon Sep 17 00:00:00 2001 From: Kirsty McCready Date: Mon, 11 Mar 2024 15:29:58 +0000 Subject: [PATCH 3/5] #1 added day to units.py --- src/oxrse_unit_conv/units.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/oxrse_unit_conv/units.py b/src/oxrse_unit_conv/units.py index ad09e02..3f2657f 100644 --- a/src/oxrse_unit_conv/units.py +++ b/src/oxrse_unit_conv/units.py @@ -8,6 +8,9 @@ hour = Unit(name='hour', abbr='h', si=second, to_si_fun=lambda n: n * 3600) h = hour +day = Unit(name='day', abbr='d', si=second, to_si_fun=lambda n: n * 86_400) +d = day + # meter kilometer = Unit(name='kilometer', abbr="km", si=meter, to_si_fun=lambda n: n * 1000) km = kilometer From 1068f79e8bec440d97d362fd7c6682c97339c1a1 Mon Sep 17 00:00:00 2001 From: Kirsty McCready Date: Mon, 11 Mar 2024 15:33:37 +0000 Subject: [PATCH 4/5] #1 added test day --- src/tests/test_unit_d.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/tests/test_unit_d.py diff --git a/src/tests/test_unit_d.py b/src/tests/test_unit_d.py new file mode 100644 index 0000000..734fd41 --- /dev/null +++ b/src/tests/test_unit_d.py @@ -0,0 +1,13 @@ +import unittest +from oxrse_unit_conv.units import d, s + +class TestDay(unittest.TestCase): + def test_SI(self): + self.assertTrue(d.si_unit.matches(s)) + + def test_basic_conversion(self): + self.assertEqual(d.to_si(1), 86_400) + self.assertEqual(d.to_unit(10, d), 10) + +if __name__ == '__main__': + unittest.main() \ No newline at end of file From fc11c32dd3348ac4c9c34cf18ca9b1547c3f3685 Mon Sep 17 00:00:00 2001 From: Kirsty McCready Date: Mon, 11 Mar 2024 15:35:22 +0000 Subject: [PATCH 5/5] #1 added day to test master --- src/tests/test_conversion_core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/test_conversion_core.py b/src/tests/test_conversion_core.py index 70acff2..178f5e8 100644 --- a/src/tests/test_conversion_core.py +++ b/src/tests/test_conversion_core.py @@ -1,6 +1,6 @@ import unittest from oxrse_unit_conv.meta import classes -from oxrse_unit_conv.units import kilometer, m, m2, m3, s, hour +from oxrse_unit_conv.units import kilometer, m, m2, m3, s, hour, day class TestConversionCore(unittest.TestCase):