Coverage for django_napse/core/models/fleets/link.py: 47%

15 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-03-12 13:49 +0000

1from django.db import models 

2 

3 

4class Link(models.Model): 

5 bot = models.OneToOneField("Bot", on_delete=models.CASCADE, related_name="link") 

6 cluster = models.ForeignKey("Cluster", on_delete=models.CASCADE, related_name="links") 

7 importance = models.FloatField() 

8 

9 def __str__(self): 

10 return f"LINK: {self.bot=} {self.cluster=}" 

11 

12 def info(self, verbose=True, beacon=""): 

13 string = "" 

14 string += f"{beacon}Link {self.pk}:\n" 

15 string += f"{beacon}Args:\n" 

16 string += f"{beacon}\t{self.bot=}\n" 

17 string += f"{beacon}\t{self.cluster=}\n" 

18 string += f"{beacon}\t{self.importance=}\n" 

19 

20 if verbose: # pragma: no cover 

21 print(string) 

22 return string