kyu_5.count_ip_addresses package

Submodules

kyu_5.count_ip_addresses.ips_between module

Solution for -> Count IP Addresses.

Created by Egor Kostan. GitHub: https://github.com/ikostan

kyu_5.count_ip_addresses.ips_between.calc_ip_range(ip, ip_id, ips_range) None[source]

Calculate IPs range.

Parameters:
  • ip

  • ip_id

  • ips_range

Returns:

None

kyu_5.count_ip_addresses.ips_between.calc_result(ips_range) int[source]

Calculate result.

Parameters:

ips_range

Returns:

int

kyu_5.count_ip_addresses.ips_between.ips_between(start: str, end: str) int[source]

Find IPs between 2 addresses.

A function that receives two IPv4 addresses, and returns the number of addresses between them (including the first one, excluding the last one). :param start: str :param end: str :return: int

kyu_5.count_ip_addresses.test_ips_between module

Test for -> Count IP Addresses.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_5.count_ip_addresses.test_ips_between.IpsBetweenTestCase(methodName='runTest')[source]

Bases: TestCase

Testing ips_between function.

_classSetupFailed = False
_class_cleanups = []
pytestmark = [Mark(name='skip', args=(), kwargs={'reason': 'The solution is not ready'})]
test_ips_between = None
test_ips_between_0_10_0_0_0(**kw)

Testing ips_between function [with start=’10.0.0.0’, end=’10.0.0.50’, expected=50].

Testing a function that receives two IPv4 addresses, and returns the number of addresses between them (including the first one, excluding the last one).

All inputs will be valid IPv4 addresses in the form of strings. The last address will always be greater than the first one. :return:

test_ips_between_1_20_0_0_10(**kw)

Testing ips_between function [with start=’20.0.0.10’, end=’20.0.1.0’, expected=246].

Testing a function that receives two IPv4 addresses, and returns the number of addresses between them (including the first one, excluding the last one).

All inputs will be valid IPv4 addresses in the form of strings. The last address will always be greater than the first one. :return:

test_ips_between_2_10_0_0_0(**kw)

Testing ips_between function [with start=’10.0.0.0’, end=’10.0.1.0’, expected=256].

Testing a function that receives two IPv4 addresses, and returns the number of addresses between them (including the first one, excluding the last one).

All inputs will be valid IPv4 addresses in the form of strings. The last address will always be greater than the first one. :return:

test_ips_between_3_170_0_0_0(**kw)

Testing ips_between function [with start=’170.0.0.0’, end=’170.1.0.0’, expected=65536].

Testing a function that receives two IPv4 addresses, and returns the number of addresses between them (including the first one, excluding the last one).

All inputs will be valid IPv4 addresses in the form of strings. The last address will always be greater than the first one. :return:

test_ips_between_4_50_0_0_0(**kw)

Testing ips_between function [with start=’50.0.0.0’, end=’50.1.1.1’, expected=65793].

Testing a function that receives two IPv4 addresses, and returns the number of addresses between them (including the first one, excluding the last one).

All inputs will be valid IPv4 addresses in the form of strings. The last address will always be greater than the first one. :return:

test_ips_between_5_180_0_0_0(**kw)

Testing ips_between function [with start=’180.0.0.0’, end=’181.0.0.0’, expected=16777216].

Testing a function that receives two IPv4 addresses, and returns the number of addresses between them (including the first one, excluding the last one).

All inputs will be valid IPv4 addresses in the form of strings. The last address will always be greater than the first one. :return:

test_ips_between_6_1_2_3_4(**kw)

Testing ips_between function [with start=’1.2.3.4’, end=’5.6.7.8’, expected=67372036].

Testing a function that receives two IPv4 addresses, and returns the number of addresses between them (including the first one, excluding the last one).

All inputs will be valid IPv4 addresses in the form of strings. The last address will always be greater than the first one. :return:

test_ips_between_7_180_0_0_0(**kw)

Testing ips_between function [with start=’180.0.0.0’, end=’181.0.0.0’, expected=16777216].

Testing a function that receives two IPv4 addresses, and returns the number of addresses between them (including the first one, excluding the last one).

All inputs will be valid IPv4 addresses in the form of strings. The last address will always be greater than the first one. :return:

test_ips_between_8_117_170_96_190(**kw)

Testing ips_between function [with start=’117.170.96.190’, end=’117.172.196.242’, expected=156724].

Testing a function that receives two IPv4 addresses, and returns the number of addresses between them (including the first one, excluding the last one).

All inputs will be valid IPv4 addresses in the form of strings. The last address will always be greater than the first one. :return:

Module contents

Count IP Addresses.