68 lines
1.2 KiB
Python
Executable File
68 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python
|
|
#!/usr/bin/env python
|
|
|
|
from dataclasses import dataclass, field, KW_ONLY
|
|
import sys
|
|
import re
|
|
import os
|
|
import enum
|
|
import itertools
|
|
from functools import partial, partialmethod
|
|
from time import sleep
|
|
from operator import itemgetter
|
|
from defl import log, cl, Path, Undefined, Null, Assert
|
|
from defl import CLIError
|
|
from defl._typing_ import *
|
|
from defl._typing_ import false, true, none
|
|
import defl
|
|
|
|
from defl.testing_ import Tester, Test, TestState
|
|
|
|
tester = Tester(name=__file__)
|
|
|
|
|
|
@dataclass(slots=True, kw_only=True, frozen=False)
|
|
class AnObject():
|
|
a: int = 1
|
|
b: int = 1
|
|
c: int = 1
|
|
d: int = 1
|
|
e: int = 1
|
|
|
|
|
|
@tester.add()
|
|
def rpr():
|
|
Assert(Assert(AnObject()).rpr).eq('AnObject(a=1, b=1, c=1, d=1, e=1)')
|
|
|
|
|
|
@tester.add()
|
|
def test():
|
|
Assert(AnObject().a).ne(2)
|
|
|
|
|
|
@tester.add()
|
|
def test():
|
|
Assert(AnObject().a).eq(1)
|
|
Assert(AnObject().a).instance(int)
|
|
Assert(AnObject()).instance(AnObject)
|
|
|
|
|
|
@tester.add()
|
|
def dig():
|
|
Assert(
|
|
[AnObject(), AnObject(), AnObject(),],
|
|
dig=True
|
|
).instance(AnObject)
|
|
|
|
|
|
@tester.add()
|
|
def digFail():
|
|
Assert(
|
|
[1, AnObject(), AnObject(),],
|
|
dig=True
|
|
).instance(AnObject)
|
|
|
|
|
|
log.info(tester.run())
|
|
tester.exitWithStatus()
|