Skip to content

Commit

Permalink
Fix some structural issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lk-geimfari committed Feb 9, 2020
1 parent 0ce0bcf commit d5dc4bb
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 53 deletions.
26 changes: 14 additions & 12 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ Version 4.0.0

.. note:: This version is still under development.

.. warning:: This release (4.0.0) contains some insignificant but breaking changes in API
.. warning:: This release (4.0.0) contains some insignificant but breaking changes in API, please be careful.

**Added**:

- Added an alias ``first_name()`` for ``Person().name()``
- Added an alias ``Person().sex(*args, **kwargs)`` for ``Person().gender()``
- Added an alias ``.first_name(*args, **kwargs)`` for the method ``Person().name()``
- Added an alias ``.sex(*args, **kwargs)`` for the method ``Person().gender()``
- Added method ``randstr()`` for class ``Random()``
- Added method ``complexes()`` for provider ``Numbers()``
- Added method ``matrix`` for provider ``Numbers()``
- Added method ``integer_number()`` for provider ``Numbers()``
- Added method ``float_number()`` for provider ``Numbers()``
- Added method ``complex_number()`` for provider ``Numbers()``
- Added method ``decimal_number()`` for provider ``Numbers()``
- Added method ``ip_v4_object()`` and ``ip_v6_object`` for provider ``Internet()``. Now you can generate IP objects, not just strings.
- Added method ``complexes()`` for the provider ``Numbers()``
- Added method ``matrix`` for the provider ``Numbers()``
- Added method ``integer_number()`` for the provider ``Numbers()``
- Added method ``float_number()`` for the provider ``Numbers()``
- Added method ``complex_number()`` for the provider ``Numbers()``
- Added method ``decimal_number()`` for the provider ``Numbers()``
- Added method ``ip_v4_object()`` and ``ip_v6_object`` for the provider ``Internet()``. Now you can generate IP objects, not just strings.
- Added new parameter ``port_range`` for method ``ip_v4()``
- Added new parameter ``separator`` for method ``Cryptographic().mnemonic_phrase()``

Expand All @@ -27,15 +27,17 @@ Version 4.0.0
**Updated**:

- Updated names and surnames for locale ``ru``
- The ``floats()`` function in the ``Numbers`` provider now accepts arguments about the range of the generated float numbers and the rounding used. By default, it generates a list of ``n`` float numbers insted of a list of 10^n elements.
- The ``floats()`` function in the ``Numbers`` provider now accepts arguments about the range of the generated float
numbers and the rounding used. By default, it generates a list of ``n`` float numbers insted of a list of 10^n elements.
- The argument ``length`` of the function ``integers`` is renamed to ``n``.

**Removed**:

- Removed the ``rating()`` method from the ``Numbers`` provider. It can be replaced with ``float(end=5, n=0, precision=1)``.
- Removed the ``rating()`` method from the ``Numbers`` provider. It can be replaced with ``float_number()``.
- Removed the ``primes()`` method from the ``Numbers`` provider.
- Removed the ``digit()`` method from the ``Numbers`` provider. Use ``integer_number()`` instead.
- Removed the ``between()`` method from the ``Numbers`` provider. Use ``integer_number()`` instead.
- Removed the ``math_formula()`` method from the ``Science`` provider.
- Removed ``rounding`` argument from ``floats()``. Now it's ``precision``.

Version 3.3.0
Expand Down
19 changes: 0 additions & 19 deletions mimesis/data/int/scientific.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,6 @@

"""Provides all the data related to science."""

MATH_FORMULAS = [
'A = (ab)/2',
'A = a2',
'A = ab',
'A = (h(a + b))/2',
'V = (Ah)/3',
'xn + xm = x(n + m)',
'(xn)/(xm) = x^n - m',
'(x/y)^n = (x^n)/(y^n)',
'x^n*y^n = (xy)^n',
'ax2 + bx + c = 0.',
'(a/b)/(c/d) = (a/b) * (d/c)',
'π = pi = 3.1415',
'A = πr^2',
'P = 4l',
'V = πr^2*h',
'V - E + F = 2',
]

SI_PREFIXES = {
'negative': [
'deci',
Expand Down
2 changes: 1 addition & 1 deletion mimesis/providers/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def credit_card_number(self, card_type: Optional[CardType] = None) -> str:
:param card_type: Issuing Network. Default is Visa.
:return: Credit card number.
:raises NotImplementedError: if cart_type is not supported.
:raises NotImplementedError: if card_type not supported.
:Example:
4455 5299 1152 2450
Expand Down
12 changes: 0 additions & 12 deletions mimesis/providers/science.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from typing import Union

from mimesis.data import MATH_FORMULAS
from mimesis.providers.base import BaseDataProvider

__all__ = ['Science']
Expand All @@ -28,17 +27,6 @@ class Meta:

name = 'science'

def math_formula(self) -> str:
"""Get a random mathematical formula.
:return: Math formula.
:Example:
A = (ab)/2.
"""
formula = self.random.choice(MATH_FORMULAS)
return formula

def chemical_element(self, name_only: bool = True) -> Union[dict, str]:
"""Generate a random chemical element.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_providers/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def test_generic_person(self, g1, g2):
assert g1.person.name() == g2.person.name()

def test_generic_science(self, g1, g2):
assert g1.science.math_formula() == g2.science.math_formula()
assert g1.science.rna_sequence() == g2.science.rna_sequence()

def test_generic_structure(self, g1, g2):
assert g1.structure.css() == g2.structure.css()
Expand Down
8 changes: 0 additions & 8 deletions tests/test_providers/test_science.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pytest

from mimesis import Science
from mimesis.data import MATH_FORMULAS

from . import patterns

Expand All @@ -19,10 +18,6 @@ def default_science(self):
def test_str(self, science):
assert re.match(patterns.DATA_PROVIDER_STR_REGEX, str(science))

def test_math_formula(self, default_science):
result = default_science.math_formula()
assert result in MATH_FORMULAS

def test_chemical_element(self, science):
result = science.chemical_element(name_only=True)
assert len(result) >= 1
Expand Down Expand Up @@ -56,9 +51,6 @@ def s1(self, seed):
def s2(self, seed):
return Science(seed=seed)

def test_math_formula(self, s1, s2):
assert s1.math_formula() == s2.math_formula()

def test_chemical_element(self, s1, s2):
assert s1.chemical_element() == s2.chemical_element()
assert s1.chemical_element(name_only=True) == \
Expand Down

0 comments on commit d5dc4bb

Please sign in to comment.