Skip to main content

la-la-la

Project description

test_figures_package

Using

  1. Triangle
data = {"a": 3, "b": 4, "c": 5}
figure = FigureFactory.create_figure("triangle", data)
figure.square() # result: 6.0
figure.is_right_angled() # result: True
  1. Create circle
data = {"r": 3}
figure = FigureFactory.create_figure("circle", data)
figure.square()
  1. Create new figure and register in FigureFactory
class Rectangle(Figure):
        def __init__(self, data: dict):
            if "a" not in data.keys() or "b" not in data.keys():
                raise ValueError("Do not finded correct shapes")
            if not (data["a"] > 0 and data["b"] > 0):
                raise ValueError("Shapes must be greated than zero")
            self.a = data["a"]
            self.b = data["b"]

        def square(self):
            return self.a * self.b

FigureFactory.register_figure("rectangle", Rectangle)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

test_figures_package-0.0.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

test_figures_package-0.0.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file test_figures_package-0.0.1.tar.gz.

File metadata

  • Download URL: test_figures_package-0.0.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.7

File hashes

Hashes for test_figures_package-0.0.1.tar.gz
Algorithm Hash digest
SHA256 65d672d60502f32eece84c73fb6224bacd332df00227f232ff892c6039dfc0e4
MD5 8f89a8799432a5b922da4160f4f2d61a
BLAKE2b-256 a3ebd50dd651667eb5ebc7791c115db290fb8280d84e44ed125e86642516a3c4

See more details on using hashes here.

File details

Details for the file test_figures_package-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for test_figures_package-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f0635e100892de1de9a80792038943e4ed9de85f31c8b28f5366b27025be08b3
MD5 94a60d6711428f33f6be433ff59ce168
BLAKE2b-256 924811ef6d9b1fa1e7d5417d887b026808351039d4588a1546f5ab64afcbe948

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page