Skip to content

Commit

Permalink
Specify return types
Browse files Browse the repository at this point in the history
  • Loading branch information
christianhelle committed Oct 19, 2024
1 parent 444aae7 commit e1f6f90
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions tests/test_create_anonymous_builtins.py
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
import unittest
from abc import abstractmethod
from typing import Type

from autofaker import Autodata


class CreateTestCase(unittest.TestCase):
@abstractmethod
def getType(self):
def getType(self) -> Type:
pass

def test_create_returns_not_none(self):
if self.getType() is None:
return
self.assertIsNotNone(Autodata.create(self.getType()))
if self.getType() is not None:
self.assertIsNotNone(Autodata.create(self.getType()))

def test_create_returns_not_type(self):
if self.getType() is None:
return
self.assertNotIsInstance(Autodata.create(self.getType()), type)
if self.getType() is not None:
self.assertNotIsInstance(Autodata.create(self.getType()), type)

def test_create_returns_not_default(self):
if self.getType() is None or self.getType() is bool or range:
return
self.assertNotEqual(Autodata.create(self.getType()), self.getType()())
if (self.getType() is not None
and not bool
and not range):
self.assertNotEqual(Autodata.create(self.getType()), self.getType()())


class AnonymousIntegerTestCase(CreateTestCase):
def getType(self):
def getType(self) -> Type[int]:
return int


class AnonymousStringTestCase(CreateTestCase):
def getType(self):
def getType(self) -> Type[str]:
return str


class AnonymousFloatTestCase(CreateTestCase):
def getType(self):
def getType(self) -> Type[float]:
return float


class AnonymousBooleanTestCase(CreateTestCase):
def getType(self):
def getType(self) -> Type[bool]:
return bool


class AnonymousComplexTestCase(CreateTestCase):
def getType(self):
def getType(self) -> Type[complex]:
return complex


class AnonymousRangeTestCase(CreateTestCase):
def getType(self):
def getType(self) -> Type[range]:
return range


class AnonymousBytesTestCase(CreateTestCase):
def getType(self):
def getType(self) -> Type[bytes]:
return bytes


class AnonymousByteArrayTestCase(CreateTestCase):
def getType(self):
def getType(self) -> Type[bytearray]:
return bytearray


class AnonymousMemoryViewTestCase(CreateTestCase):
def getType(self):
def getType(self) -> Type[memoryview]:
return memoryview


class AnonymousSetTestCase(CreateTestCase):
def getType(self):
def getType(self) -> Type[set]:
return set


class AnonymousFrozensetTestCase(CreateTestCase):
def getType(self):
def getType(self) -> Type[frozenset]:
return frozenset

0 comments on commit e1f6f90

Please sign in to comment.