kopia lustrzana https://github.com/sepandhaghighi/samila
Update test (#126)
* fix : test updated * fix : is_same_data function bug fixed * fix : test updated * doc : CHANGELOG updated * fix : minor edit in test * fix : minor edit in test spacespull/127/head
rodzic
d2b7585b1a
commit
e0cc52f74c
|
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||
- Random mode modified
|
||||
- `filter_color` function modified
|
||||
- `filter_projection` function modified
|
||||
- `is_same_data` function modified
|
||||
- `README.md` updated
|
||||
## [0.6] - 2022-04-13
|
||||
### Added
|
||||
|
|
|
@ -516,6 +516,8 @@ def is_same_data(data1, data2, precision=10**-5):
|
|||
:type precision: float
|
||||
:return: True if they are the same
|
||||
"""
|
||||
if len(data1) != len(data2):
|
||||
return False
|
||||
is_same = map(lambda x, y: abs(x - y) < precision, data1, data2)
|
||||
return all(is_same)
|
||||
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
True
|
||||
>>> is_same_data([1,1.1,1.2,1.3,1.4],[1,1.11,1.3,1.4,1.5])
|
||||
False
|
||||
>>> is_same_data(s,[1,1.1,1.2,1.3,1.4,1.5,1.6])
|
||||
False
|
||||
>>> is_same_data(s,[])
|
||||
False
|
||||
>>> filter_color("yellow")
|
||||
'yellow'
|
||||
>>> filter_color((0.2,0.3,0.4))
|
||||
|
|
|
@ -208,6 +208,22 @@ False
|
|||
>>> del(g)
|
||||
>>> del g_.data1
|
||||
>>> del(g_)
|
||||
>>> g1 = GenerativeImage()
|
||||
>>> function1 = eval("lambda x, y:" + g1.function1_str)
|
||||
>>> function2 = eval("lambda x, y:" + g1.function2_str)
|
||||
>>> g2 = GenerativeImage(function1=function1, function2=function2)
|
||||
>>> g1.generate(seed=22)
|
||||
>>> g2.generate(seed=22)
|
||||
>>> is_same_data(g1.data1, g2.data1)
|
||||
True
|
||||
>>> is_same_data(g1.data2, g2.data2)
|
||||
True
|
||||
>>> len(g1.data1) > 0
|
||||
True
|
||||
>>> len(g1.data2) > 0
|
||||
True
|
||||
>>> del(g1)
|
||||
>>> del(g2)
|
||||
>>> os.remove("test.png")
|
||||
>>> os.remove("test2.png")
|
||||
>>> os.remove("data.json")
|
||||
|
|
Ładowanie…
Reference in New Issue