From 05a78be65b93c889012aef3c806015d4f93b55d0 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Sat, 30 Apr 2022 13:03:53 +0100 Subject: [PATCH] Add docstrings --- app/main.py | 3 +++ tests/test_main.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index a39d101..85e0259 100644 --- a/app/main.py +++ b/app/main.py @@ -6,6 +6,7 @@ import argparse def parse_args(): # pragma: no cover + """Get arguments from CLI.""" parser = argparse.ArgumentParser(description="Get 6to4 address from IPv4 address.") parser.add_argument( "-a", @@ -19,6 +20,7 @@ def parse_args(): # pragma: no cover def ipv4_to_ipv6(ipv4): + """COnvert IPv4 address to IPv6.""" ipv4_hex = "" ipv6_hextets = ["", ""] @@ -49,6 +51,7 @@ def ipv4_to_ipv6(ipv4): def main(): # pragma: no cover + """Main function.""" ipv4 = parse_args().address output = ipv4_to_ipv6(ipv4) print(output) diff --git a/tests/test_main.py b/tests/test_main.py index 8f4f589..0c6789a 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -4,6 +4,8 @@ from app.main import ipv4_to_ipv6 + def test_ipv4_to_ipv6(): - result = ipv4_to_ipv6('192.168.0.1') + """Test case for ipv4_to_ipv6().""" + result = ipv4_to_ipv6("192.168.0.1") assert result == "2002:c0a8:1::/128"