omerXfaruq commited on
Commit
9ffc074
1 Parent(s): 41930b6
Files changed (2) hide show
  1. README.md +6 -0
  2. tests.py +41 -0
README.md CHANGED
@@ -8,6 +8,12 @@ app_file: app.py
8
  pinned: false
9
  ---
10
 
 
 
 
 
 
 
11
  # Configuration
12
 
13
  `title`: _string_
 
8
  pinned: false
9
  ---
10
 
11
+ # Tests
12
+ ```
13
+ pytest -v --cov=. --cov-report term-missing tests.py
14
+ ```
15
+
16
+
17
  # Configuration
18
 
19
  `title`: _string_
tests.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+ from app import SpaceBuilder
3
+
4
+
5
+ class TestUnit:
6
+ class TestSpaceBuilder:
7
+ def test_split_space_names(self):
8
+ input = (
9
+ f"nielsr/LayoutLMv2-FUNSD"
10
+ f"\nvalhalla/glide-text2im"
11
+ f"\n"
12
+ f"\n "
13
+ f"\n "
14
+ f"\nvalhalla/glide-text2im"
15
+ f"\n "
16
+ f"\nvalhalla/glide-text2im"
17
+ f"\n"
18
+ )
19
+ expected_output = (
20
+ ["spaces/nielsr/LayoutLMv2-FUNSD", "spaces/valhalla/glide-text2im", "spaces/valhalla/glide-text2im", "spaces/valhalla/glide-text2im"]
21
+ )
22
+ assert expected_output == SpaceBuilder.split_space_names(input)
23
+
24
+ def test_check_space_name_availability(self):
25
+ random_token = "123123"
26
+ random_space_name = "123123"
27
+ assert SpaceBuilder.check_space_name_availability(random_token, random_space_name) is False
28
+
29
+ def test_load_and_check_spaces_1(self):
30
+ input = (
31
+ f"nielsr/LayoutLMv2-FUNSD"
32
+ f"\nvalhalla/glide-text2im"
33
+ )
34
+ assert SpaceBuilder.load_and_check_spaces(names=input) is False
35
+
36
+ def test_load_and_check_spaces_2(self):
37
+ input = (
38
+ f"valhalla/glide-text2im"
39
+ f"\nvalhalla/glide-text2im"
40
+ )
41
+ assert SpaceBuilder.load_and_check_spaces(names=input) is True